/* this is a NULL terminated array contating a list of strings that should
*causeast_format_str_reduce()tofail*/
staticchar*fail_strings[]={
"this will fail",/* format does not exist */
"this one|should|fail also",/* format does not exist */
NULL,
};
AST_TEST_DEFINE(ast_format_str_reduce_test_1)
{
inti;
char*c;
switch(cmd){
caseTEST_INIT:
info->name="ast_format_str_reduce_test_1";
info->category="main/file/";
info->summary="reduce format strings";
info->description="Reduce some format strings and make sure the results match what we expect.";
returnAST_TEST_NOT_RUN;
caseTEST_EXECUTE:
break;
}
for(i=0;test_strings[i][0];i++){
c=ast_strdupa(test_strings[i][0]);
if(!(c=ast_format_str_reduce(c))){
ast_str_set(&args->ast_test_error_str,0,"Error running ast_format_str_reduce() on string '%s'\n",test_strings[i][0]);
returnAST_TEST_FAIL;
}
if(strcmp(test_strings[i][1],c)){
ast_str_set(&args->ast_test_error_str,0,"Format string '%s' reduced to '%s'. Expected '%s'\n",test_strings[i][0],c,test_strings[i][1]);
returnAST_TEST_FAIL;
}
}
for(i=0;fail_strings[i];i++){
c=ast_strdupa(fail_strings[i]);
if((c=ast_format_str_reduce(c))){
ast_str_set(&args->ast_test_error_str,0,"ast_format_str_reduce() succeded on string '%s' with result '%s', but we expected it to fail\n",fail_strings[i],c);