40 #define BASE_GROUP "a group" 44 enum test_option_flags {
49 enum test_option_args {
52 OPT_ARG_WITHBACKSLASH,
67 {
"a(simple)b(\"quoted\")c(back\\slash)", {
"simple",
"quoted",
"backslash", }, },
68 {
"b(\"((())))\")a(simple)c(back\\)slash)", {
"simple",
"((())))",
"back)slash", }, },
69 {
"b(\"((\\\"\\)\\(\")a(simple)c(back\\\"\\)\\(\\\"slash)", {
"simple",
"((\"\\)\\(",
"back\")(\"slash", }, },
76 info->name =
"options_parsing";
77 info->category =
"/main/app/";
78 info->summary =
"App options unit test";
80 "This tests the options parsing code to ensure that it behaves as expected";
94 for (j = 0; j < 3; j++) {
97 "but it should have produced '%s'\n",
110 for (j = 0; j < 3; j++) {
113 "but it should have produced '%s'\n",
131 static const char group1_full[] =
BASE_GROUP "groupgroup";
132 static const char group2_full[] =
BASE_GROUP "Groupgroup";
133 static const char regex1[] =
"gr";
134 static const char regex2[] =
"(group){2}$";
135 static const char regex3[] =
"[:ascii:]";
136 static const char regex4[] =
"^(NOMATCH)";
137 static const char category1_full[] =
BASE_GROUP "@a_category";
138 static const char category2_full[] =
BASE_GROUP "@another!Category";
139 static const char regex5[] =
"(gory)$";
140 static const char regex6[] =
"[A-Z]+";
141 static const char regex7[] =
"[[";
143 static const struct group_test_params {
144 const char *groupmatch;
145 const char *category;
162 info->name =
"app_group";
163 info->category =
"/main/app/";
164 info->summary =
"App group unit test";
166 "This tests various app group functionality";
173 "'%s', '%s', '%s', '%s'\n", group1_full, group2_full, category1_full, category2_full);
177 goto exit_group_test;
182 goto exit_group_test;
187 goto exit_group_test;
192 goto exit_group_test;
201 for (i = 0; i <
ARRAY_LEN(subtests); i++) {
205 if (subtests[i].expected != returned_count) {
207 i + 1, subtests[i].expected, returned_count, subtests[i].groupmatch, subtests[i].category);
209 goto exit_group_test;
212 i + 1, subtests[i].expected, subtests[i].groupmatch, subtests[i].category);
Main Channel structure associated with a channel.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
Asterisk main include file. File version handling, generic pbx functions.
#define AST_TEST_REGISTER(cb)
Structure used to handle a large number of boolean flags == used only in app_dial?
static int load_module(void)
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
General Asterisk PBX channel definitions.
#define ast_test_status_update(a, b, c...)
AST_TEST_DEFINE(options_parsing)
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
int ast_app_parse_options64(const struct ast_app_option *options, struct ast_flags64 *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
#define AST_APP_OPTION_ARG(option, flagno, argno)
Declares an application option that accepts an argument.
#define AST_TEST_UNREGISTER(cb)
#define ast_channel_unlock(chan)
static void parse(struct mgcp_request *req)
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
int ast_app_group_match_get_count(const char *groupmatch, const char *category)
Get the current channel count of all groups that match the specified pattern and category.
Structure used to handle boolean flags.
static int unload_module(void)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
#define ASTERISK_GPL_KEY
The text the key() function should return.
#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag,...)
Create a channel structure.
Asterisk module definitions.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
int ast_app_group_set_channel(struct ast_channel *chan, const char *data)
Set the group for a channel, splitting the provided data into group and category, if specified...