aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-02-05 19:07:18 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-02-05 19:07:18 +0000
commit8d1c94179d2bc6b52c351e66c42d78fd90045386 (patch)
treeca2c3169b7048aff7a0263b19ba66507ba25848a
parent18b029228da17ef3621d5db3bca96a8c91f043d9 (diff)
Merge tests that verify the same thing. (Oops.)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@245046 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--main/file.c55
-rw-r--r--tests/test_ast_format_str_reduce.c4
2 files changed, 4 insertions, 55 deletions
diff --git a/main/file.c b/main/file.c
index b8b41e5fe..ed9dbb22c 100644
--- a/main/file.c
+++ b/main/file.c
@@ -1464,63 +1464,8 @@ static struct ast_cli_entry cli_file[] = {
AST_CLI_DEFINE(handle_cli_core_show_file_formats, "Displays file formats")
};
-#ifdef TEST_FRAMEWORK
-AST_TEST_DEFINE(test_ast_format_str_reduce)
-{
- enum ast_test_result_state res = AST_TEST_PASS;
- int i;
- struct {
- const char *input;
- const char *output;
- } tests[] = {
- { "wav", "wav" },
- { "wav|gsm", "wav|gsm" },
- { "wav|ulaw|gsm", "wav|ulaw|gsm" },
- { "wav|WAV|gsm", "wav|WAV|gsm" },
- { "wav|wav49|gsm", "wav|wav49|gsm" },
- { "wav|invalid|gsm", "wav|gsm" },
- { "invalid|gsm", "gsm" },
- { "ulaw|gsm|invalid", "ulaw|gsm" },
- { "g723|g726-40|g729|gsm|ilbc|ogg|wav|WAV|siren7|siren14|sln", "g723|g726-40|g729|gsm|ilbc|ogg|wav|WAV|siren7|siren14" },
- { "ulaw|gsm|ulaw", "ulaw|gsm" },
- { "ulaw|alaw|gsm|wav|alaw|g729", "ulaw|alaw|gsm|wav|g729" },
- { "", "" },
- { NULL, },
- };
-
- switch (cmd) {
- case TEST_INIT:
- info->name = "test_ast_format_str_reduce";
- info->category = "main/file/";
- info->summary = "Test functionality of ast_format_str_reduce API";
- info->description =
- "This test runs the format string reduction API through a series of tests to ensure that it is functioning properly.";
- return AST_TEST_NOT_RUN;
- case TEST_EXECUTE:
- break;
- }
-
- ast_str_reset(args->ast_test_error_str);
- for (i = 0; tests[i].input; i++) {
- char tmp[256], *ret;
- ast_copy_string(tmp, tests[i].input, sizeof(tmp));
- if ((ret = ast_format_str_reduce(tmp)) && strcmp(ret, tests[i].output)) {
- res = AST_TEST_FAIL;
- ast_str_append(&args->ast_test_error_str, 0, "Format reduction of string '%s' produced '%s', but should have produced '%s'.\n",
- tests[i].input, tmp, tests[i].output);
- } else if (!ret && !ast_strlen_zero(tests[i].output)) {
- res = AST_TEST_FAIL;
- ast_str_append(&args->ast_test_error_str, 0, "Format reduction of string '%s' errored out, but should have produced '%s'.\n",
- tests[i].input, tests[i].output);
- }
- }
- return res;
-}
-#endif
-
int ast_file_init(void)
{
ast_cli_register_multiple(cli_file, ARRAY_LEN(cli_file));
- AST_TEST_REGISTER(test_ast_format_str_reduce);
return 0;
}
diff --git a/tests/test_ast_format_str_reduce.c b/tests/test_ast_format_str_reduce.c
index 7cb0285b3..f6046ea9a 100644
--- a/tests/test_ast_format_str_reduce.c
+++ b/tests/test_ast_format_str_reduce.c
@@ -49,6 +49,10 @@ static char *test_strings[][2] = {
{"wav|ulaw|pcm|alaw|sln|raw", "wav|ulaw|alaw|sln"},
{"wav|gsm|wav49", "wav|gsm|wav49"},
{"WAV|gsm|wav49", "WAV|gsm"},
+ {"wav|invalid|gsm", "wav|gsm"},
+ {"invalid|gsm", "gsm"},
+ {"ulaw|gsm|invalid", "ulaw|gsm"},
+ {"g723|g726-40|g729|gsm|ilbc|ogg|wav|WAV|siren7|siren14|sln", "g723|g726-40|g729|gsm|ilbc|ogg|wav|WAV|siren7|siren14"},
{NULL, NULL},
};