51 static char *test_strings[][2] = {
53 {
"wav|ulaw",
"wav|ulaw"},
54 {
"pcm|wav",
"pcm|wav"},
55 {
"pcm|wav|ulaw",
"pcm|wav"},
56 {
"wav|ulaw|pcm",
"wav|ulaw"},
57 {
"wav|ulaw|pcm|alaw",
"wav|ulaw|alaw"},
58 {
"pcm|ulaw|ul|mu|ulw",
"pcm"},
59 {
"wav|ulaw|pcm|alaw|sln|raw",
"wav|ulaw|alaw|sln"},
60 {
"wav|gsm|wav49",
"wav|gsm|wav49"},
61 {
"WAV|gsm|wav49",
"WAV|gsm"},
62 {
"wav|invalid|gsm",
"wav|gsm"},
63 {
"invalid|gsm",
"gsm"},
64 {
"ulaw|gsm|invalid",
"ulaw|gsm"},
65 {
"g723|g726-40|g729|gsm|ilbc|ogg|wav|WAV|siren7|siren14|sln",
"g723|g726-40|g729|gsm|ilbc|ogg|wav|WAV|siren7|siren14"},
71 static char *fail_strings[] = {
73 "this one|should|fail also",
84 info->name =
"ast_format_str_reduce_test_1";
85 info->category =
"/main/file/";
86 info->summary =
"reduce format strings";
87 info->description =
"Reduce some format strings and make sure the results match what we expect.";
88 return AST_TEST_NOT_RUN;
93 for (i = 0; test_strings[i][0]; i++) {
96 ast_test_status_update(
test,
"Error running ast_format_str_reduce() on string '%s'\n",
101 if (strcmp(test_strings[i][1], c)) {
102 ast_test_status_update(
test,
"Format string '%s' reduced to '%s'. Expected '%s'\n",
103 test_strings[i][0], c, test_strings[i][1]);
104 return AST_TEST_FAIL;
108 for (i = 0; fail_strings[i]; i++) {
111 ast_test_status_update(
test,
"ast_format_str_reduce() succeded on string '%s' "
112 "with result '%s', but we expected it to fail\n",
114 return AST_TEST_FAIL;
118 return AST_TEST_PASS;
121 static int unload_module(
void)
123 AST_TEST_UNREGISTER(ast_format_str_reduce_test_1);
127 static int load_module(
void)
130 AST_TEST_REGISTER(ast_format_str_reduce_test_1);
135 AST_MODULE_INFO_STANDARD(
ASTERISK_GPL_KEY,
"ast_format_str_reduce() test module");
Asterisk main include file. File version handling, generic pbx functions.
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
#define ast_strdupa(s)
duplicate a string in memory from the stack
char * ast_format_str_reduce(char *fmts)
#define AST_TEST_DEFINE(hdr)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.