125{
130
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;
146 int expected;
147 } subtests[] = {
148 { regex1, "", 4 },
149 { regex2, "", 1 },
150 { regex3, "", 4 },
151 { regex4, "", 0 },
154
156 };
157 int i;
158 int returned_count;
159
160 switch (cmd) {
162 info->name =
"app_group";
163 info->category =
"/main/app/";
164 info->summary =
"App group unit test";
166 "This tests various app group functionality";
169 break;
170 }
171
173 "'%s', '%s', '%s', '%s'\n", group1_full, group2_full, category1_full, category2_full);
174
177 goto exit_group_test;
178 }
182 goto exit_group_test;
183 }
187 goto exit_group_test;
188 }
192 goto exit_group_test;
193 }
195
200
201 for (i = 0; i <
ARRAY_LEN(subtests); i++) {
204
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;
210 } else {
212 i + 1, subtests[i].expected, subtests[i].groupmatch, subtests[i].category);
213 }
214 }
215
216exit_group_test:
221 return res;
222}
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)
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.
Main Channel structure associated with a channel.
#define ast_test_status_update(a, b, c...)