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++) {
95 if (strcmp(opt_args[j],
options[i].parse[j])) {
97 "but it should have produced '%s'\n",
110 for (j = 0; j < 3; j++) {
111 if (strcmp(opt_args[j],
options[i].parse[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);
Asterisk main include file. File version handling, generic pbx functions.
General Asterisk PBX channel definitions.
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag,...)
Create a channel structure.
#define ast_channel_unlock(chan)
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
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.
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.
#define AST_APP_OPTION_ARG(option, flagno, argno)
Declares an application option that accepts an argument.
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.
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
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Main Channel structure associated with a channel.
Structure used to handle a large number of boolean flags == used only in app_dial?
Structure used to handle boolean flags.
#define AST_TEST_REGISTER(cb)
#define ast_test_status_update(a, b, c...)
#define AST_TEST_UNREGISTER(cb)
AST_TEST_DEFINE(options_parsing)
static int load_module(void)
static int unload_module(void)