47 info->name =
"format_cache_set";
48 info->category =
"/main/format_cache/";
49 info->summary =
"format cache add unit test";
51 "Test that adding of a cached format succeeds";
52 return AST_TEST_NOT_RUN;
59 ast_test_status_update(
test,
"Could not retrieve built-in ulaw codec\n");
65 ast_test_status_update(
test,
"Could not create format using built-in codec\n");
70 ast_test_status_update(
test,
"Could not add just created format to cache\n");
84 info->name =
"format_cache_set_duplicate";
85 info->category =
"/main/format_cache/";
86 info->summary =
"format cache add unit test";
88 "Test that adding of a cached format multiple times succeeds";
89 return AST_TEST_NOT_RUN;
96 ast_test_status_update(
test,
"Could not retrieve built-in ulaw codec\n");
102 ast_test_status_update(
test,
"Could not create format using built-in codec\n");
103 return AST_TEST_FAIL;
107 ast_test_status_update(
test,
"Could not add just created format to cache\n");
108 return AST_TEST_FAIL;
112 ast_test_status_update(
test,
"Failed to update cached format\n");
113 return AST_TEST_FAIL;
116 return AST_TEST_PASS;
126 info->name =
"format_cache_set_null";
127 info->category =
"/main/format_cache/";
128 info->summary =
"format cache add unit test";
130 "Test that adding a NULL or empty format to the cache does not succeed";
131 return AST_TEST_NOT_RUN;
138 ast_test_status_update(
test,
"Could not retrieve built-in ulaw codec\n");
139 return AST_TEST_FAIL;
144 ast_test_status_update(
test,
"Could not create format using built-in codec\n");
145 return AST_TEST_FAIL;
149 ast_test_status_update(
test,
"Successfully cached a format with an empty name\n");
150 return AST_TEST_FAIL;
153 return AST_TEST_PASS;
164 info->name =
"format_cache_get";
165 info->category =
"/main/format_cache/";
166 info->summary =
"format cache get unit test";
168 "Test that getting of a cached format succeeds";
169 return AST_TEST_NOT_RUN;
176 ast_test_status_update(
test,
"Could not retrieve built-in ulaw codec\n");
177 return AST_TEST_FAIL;
182 ast_test_status_update(
test,
"Could not create format using built-in codec\n");
183 return AST_TEST_FAIL;
187 ast_test_status_update(
test,
"Could not add just created format to cache\n");
188 return AST_TEST_FAIL;
193 ast_test_status_update(
test,
"Failed to retrieve a format we just cached\n");
194 return AST_TEST_FAIL;
195 }
else if (cached != format) {
196 ast_test_status_update(
test,
"Returned cached format does not match format we just added\n");
197 return AST_TEST_FAIL;
200 return AST_TEST_PASS;
211 info->name =
"format_cache_get_nonxistent";
212 info->category =
"/main/format_cache/";
213 info->summary =
"format cache get unit test";
215 "Test that getting of a non-existent cached format does not succeed";
216 return AST_TEST_NOT_RUN;
223 ast_test_status_update(
test,
"Could not retrieve built-in ulaw codec\n");
224 return AST_TEST_FAIL;
229 ast_test_status_update(
test,
"Could not create format using built-in codec\n");
230 return AST_TEST_FAIL;
234 ast_test_status_update(
test,
"Could not add just created format to cache\n");
235 return AST_TEST_FAIL;
240 ast_test_status_update(
test,
"Retrieved a cached format when one should not have existed\n");
241 return AST_TEST_FAIL;
246 ast_test_status_update(
test,
"Retrieved a cached format when we provided an empty name\n");
247 return AST_TEST_FAIL;
252 ast_test_status_update(
test,
"Retrieved a cached format when we provided a NULL name\n");
253 return AST_TEST_FAIL;
256 return AST_TEST_PASS;
259 static int unload_module(
void)
261 AST_TEST_UNREGISTER(format_cache_set);
262 AST_TEST_UNREGISTER(format_cache_set_duplicate);
263 AST_TEST_UNREGISTER(format_cache_set_null);
264 AST_TEST_UNREGISTER(format_cache_get);
265 AST_TEST_UNREGISTER(format_cache_get_nonexistent);
269 static int load_module(
void)
271 AST_TEST_REGISTER(format_cache_set);
272 AST_TEST_REGISTER(format_cache_set_duplicate);
273 AST_TEST_REGISTER(format_cache_set_null);
274 AST_TEST_REGISTER(format_cache_get);
275 AST_TEST_REGISTER(format_cache_get_nonexistent);
Asterisk main include file. File version handling, generic pbx functions.
struct ast_codec * ast_codec_get(const char *name, enum ast_media_type type, unsigned int sample_rate)
Retrieve a codec given a name, type, and sample rate.
#define AST_TEST_DEFINE(hdr)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Represents a media codec within Asterisk.