[asterisk-commits] file: branch group/media_formats r407189 - /team/group/media_formats/tests/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Feb 3 10:27:46 CST 2014
Author: file
Date: Mon Feb 3 10:27:44 2014
New Revision: 407189
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=407189
Log:
Add a test for format_cap_remove_all.
Modified:
team/group/media_formats/tests/test_format_cap.c
Modified: team/group/media_formats/tests/test_format_cap.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/tests/test_format_cap.c?view=diff&rev=407189&r1=407188&r2=407189
==============================================================================
--- team/group/media_formats/tests/test_format_cap.c (original)
+++ team/group/media_formats/tests/test_format_cap.c Mon Feb 3 10:27:44 2014
@@ -492,6 +492,41 @@
return AST_TEST_PASS;
}
+AST_TEST_DEFINE(format_cap_remove_all)
+{
+ RAII_VAR(struct ast_format_cap *, caps, NULL, ao2_cleanup);
+
+ switch (cmd) {
+ case TEST_INIT:
+ info->name = "format_cap_remove_all";
+ info->category = "/main/format_cap/";
+ info->summary = "format capabilities removal unit test";
+ info->description =
+ "Test that removal of all formats from a format capabilities structure succeeds";
+ return AST_TEST_NOT_RUN;
+ case TEST_EXECUTE:
+ break;
+ }
+
+ caps = ast_format_cap_ng_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
+ if (!caps) {
+ ast_test_status_update(test, "Could not allocate an empty format capabilities structure\n");
+ return AST_TEST_FAIL;
+ } else if (ast_format_cap_ng_add_all_by_type(caps, AST_MEDIA_TYPE_UNKNOWN)) {
+ ast_test_status_update(test, "Failed to add all media formats of all types to capabilities structure\n");
+ return AST_TEST_FAIL;
+ }
+
+ ast_format_cap_ng_remove_all(caps);
+
+ if (ast_format_cap_ng_count(caps)) {
+ ast_test_status_update(test, "Removed all formats from capabilities structure but some remain\n");
+ return AST_TEST_FAIL;
+ }
+
+ return AST_TEST_PASS;
+}
+
static int unload_module(void)
{
AST_TEST_UNREGISTER(format_cap_alloc);
@@ -502,6 +537,7 @@
AST_TEST_UNREGISTER(format_cap_remove_single);
AST_TEST_UNREGISTER(format_cap_remove_multiple);
AST_TEST_UNREGISTER(format_cap_remove_bytype);
+ AST_TEST_UNREGISTER(format_cap_remove_all);
return 0;
}
@@ -515,6 +551,7 @@
AST_TEST_REGISTER(format_cap_remove_single);
AST_TEST_REGISTER(format_cap_remove_multiple);
AST_TEST_REGISTER(format_cap_remove_bytype);
+ AST_TEST_REGISTER(format_cap_remove_all);
return AST_MODULE_LOAD_SUCCESS;
}
More information about the asterisk-commits
mailing list