54 {
"4 + 2 * 8",
"20" },
55 {
"(4 + 2) * 8",
"48" },
56 {
"4 + (2 * 8)",
"20" },
57 {
"4 + (2 * 8) ? 3 :: 6",
"3" },
59 {
"FLOOR(4 + 8 / 3)",
"6" },
107 {
"3 > 4 & 4 < 3",
"0" },
108 {
"4 > 3 & 3 < 4",
"1" },
113 {
"\"Something interesting\" =~ interesting",
"11" },
114 {
"\"Something interesting\" =~ Something",
"9" },
115 {
"\"Something interesting\" : Something",
"9" },
116 {
"\"Something interesting\" : interesting",
"0" },
117 {
"\"Something interesting\" =~ \"interesting\"",
"11" },
118 {
"\"Something interesting\" =~ \"Something\"",
"9" },
119 {
"\"Something interesting\" : \"Something\"",
"9" },
120 {
"\"Something interesting\" : \"interesting\"",
"0" },
121 {
"\"Something interesting\" =~ (interesting)",
"11" },
122 {
"\"Something interesting\" =~ (Something)",
"9" },
123 {
"\"Something interesting\" : (Something)",
"9" },
124 {
"\"Something interesting\" : (interesting)",
"0" },
125 {
"\"Something interesting\" =~ \"\\(interesting\\)\"",
"0" },
126 {
"\"Something interesting\" =~ \"\\(Something\\)\"",
"0" },
127 {
"\"Something interesting\" : \"\\(Something\\)\"",
"0" },
128 {
"\"Something interesting\" : \"\\(interesting\\)\"",
"0" },
129 {
"\"011043567857575\" : \"011\\(..\\)\"",
"0" },
130 {
"\"9011043567857575\" : \"011\\(..\\)\"",
"0" },
131 {
"\"011043567857575\" =~ \"011\\(..\\)\"",
"0" },
132 {
"\"9011043567857575\" =~ \"011\\(..\\)\"",
"0" },
133 {
"\"Something interesting\" =~ (interesting)",
"11" },
134 {
"\"Something interesting\" =~ (Something)",
"9" },
135 {
"\"Something interesting\" : (Something)",
"9" },
136 {
"\"Something interesting\" : (interesting)",
"0" },
137 {
"\"Something interesting\" =~ \"(interesting)\"",
"interesting" },
138 {
"\"Something interesting\" =~ \"(Something)\"",
"Something" },
139 {
"\"Something interesting\" : \"(Something)\"",
"Something" },
140 {
"\"Something interesting\" : \"(interesting)\"",
"" },
141 {
"\"011043567857575\" : \"011(..)\"",
"04" },
142 {
"\"9011043567857575\" : \"011(..)\"",
"" },
143 {
"\"011043567857575\" =~ \"011(..)\"",
"04" },
144 {
"\"9011043567857575\" =~ \"011(..)\"",
"04" },
146 {
"something",
"something" },
148 {
"${GLOBAL(ULKOPREFIX)}9${x}",
"${GLOBAL(ULKOPREFIX)}9${x}" },
149 {
"512059${x}",
"512059${x}" },
155 info->name =
"expr_test";
156 info->category =
"/main/ast_expr/";
157 info->summary =
"unit test for the internal expression engine";
159 "Verifies behavior for the internal expression engine";
166 memset(
buf, 0,
sizeof(
buf));
169 if (strcmp(
buf, tests[i].output)) {
static int input(yyscan_t yyscanner)
int ast_expr(char *expr, char *buf, int length, struct ast_channel *chan)
Evaluate the given expression.
Asterisk main include file. File version handling, generic pbx functions.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
Asterisk module definitions.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
#define AST_TEST_REGISTER(cb)
#define ast_test_status_update(a, b, c...)
#define AST_TEST_UNREGISTER(cb)
static int load_module(void)
AST_TEST_DEFINE(expr_test)
static int unload_module(void)