190 static const char registrar[] =
"test_pbx";
192 static const char TEST_PATTERN[] =
"test_pattern";
193 static const char TEST_PATTERN_INCLUDE[] =
"test_pattern_include";
200 const char * context_string;
203 { TEST_PATTERN_INCLUDE, },
214 const char *outer_context;
215 const char *inner_context;
216 } context_includes[] = {
217 { TEST_PATTERN, TEST_PATTERN_INCLUDE },
229 [0] = { TEST_PATTERN,
"_2.",
NULL, 1, { 1 } },
230 [1] = { TEST_PATTERN,
"2000",
NULL, 1, { 1 } },
231 [2] = { TEST_PATTERN_INCLUDE,
"2000",
NULL, 1, { 2 } },
242 { TEST_PATTERN,
"200",
NULL, 1, &extens[0] },
243 { TEST_PATTERN,
"2000",
NULL, 1, &extens[1] },
244 { TEST_PATTERN,
"2000",
NULL, 2, &extens[2] },
245 { TEST_PATTERN_INCLUDE,
"2000",
NULL, 2, &extens[2] },
250 info->name =
"pattern_match_test";
251 info->category =
"/main/pbx/";
252 info->summary =
"Test pattern matching";
253 info->description =
"Create a context with a bunch of extensions within. Then attempt\n" 254 "to match some strings to the extensions.";
276 for (i = 0; i <
ARRAY_LEN(context_includes); ++i) {
278 context_includes[i].inner_context, registrar)) {
280 context_includes[i].inner_context, context_includes[i].outer_context);
286 for (i = 0; i <
ARRAY_LEN(extens); ++i) {
290 "Max is %d, but we requested %d. Test failed\n",
297 NULL, extens[i].cid,
"Noop", (
void *) extens[i].exten,
NULL, registrar)) {
299 "Test failed\n", extens[i].exten, extens[i].priorities[priority], extens[i].context);
310 for (j = 0; j < 2; j++) {
static char exten[AST_MAX_EXTENSION]
int ast_context_add_include(const char *context, const char *include, const char *registrar)
Add a context include.
#define ast_test_status_update(a, b, c...)
int pbx_set_extenpatternmatchnew(int newval)
struct ast_context * contexts
const int num_priorities
Number of priorities.
static void * cleanup(void *unused)
an extension to add to our context
int ast_add_extension(const char *context, int replace, const char *extension, int priority, const char *label, const char *callerid, const char *application, void *data, void(*datad)(void *), const char *registrar)
Add and extension to an extension context.
void ast_context_destroy(struct ast_context *con, const char *registrar)
Destroy a context (matches the specified context or ANY context if NULL)
static char context[AST_MAX_CONTEXT]
struct ast_context * ast_context_find_or_create(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *name, const char *registrar)
Register a new context or find an existing one.
static int test_exten(const struct pbx_test_pattern *test_pattern, struct ast_test *test, int new_engine)