[svn-commits] file: branch group/media_formats r406915 - /team/group/media_formats/tests/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jan 29 11:10:57 CST 2014


Author: file
Date: Wed Jan 29 11:10:55 2014
New Revision: 406915

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=406915
Log:
Add a test for format attribute setting on a format without an interface.

Modified:
    team/group/media_formats/tests/test_core_format.c

Modified: team/group/media_formats/tests/test_core_format.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/tests/test_core_format.c?view=diff&rev=406915&r1=406914&r2=406915
==============================================================================
--- team/group/media_formats/tests/test_core_format.c (original)
+++ team/group/media_formats/tests/test_core_format.c Wed Jan 29 11:10:55 2014
@@ -309,6 +309,43 @@
 		return AST_TEST_FAIL;
 	} else if (copy != format) {
 		ast_test_status_update(test, "Copying of a format returned a new format instead of the same one\n");
+		return AST_TEST_FAIL;
+	}
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(format_attribute_set_without_interface)
+{
+	RAII_VAR(struct ast_codec *, codec, NULL, ao2_cleanup);
+	RAII_VAR(struct ast_format *, format, NULL, ao2_cleanup);
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "format_attribute_set_without_interface";
+		info->category = "/main/core_format/";
+		info->summary = "format attribute setting unit test";
+		info->description =
+			"Test that attribute setting on a format without an interface fails";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
+	codec = ast_codec_get("ulaw", AST_MEDIA_TYPE_AUDIO, 8000);
+	if (!codec) {
+		ast_test_status_update(test, "Could not retrieve built-in ulaw codec\n");
+		return AST_TEST_FAIL;
+	}
+
+	format = ast_format_ng_create(codec);
+	if (!format) {
+		ast_test_status_update(test, "Could not create format using built-in codec\n");
+		return AST_TEST_FAIL;
+	}
+
+	if (!ast_format_ng_attribute_set(format, "bees", "cool")) {
+		ast_test_status_update(test, "Successfully set an attribute on a format without an interface\n");
 		return AST_TEST_FAIL;
 	}
 
@@ -323,6 +360,7 @@
 	AST_TEST_UNREGISTER(format_joint_same_codec);
 	AST_TEST_UNREGISTER(format_joint_different_codec);
 	AST_TEST_UNREGISTER(format_copy);
+	AST_TEST_UNREGISTER(format_attribute_set_without_interface);
 	return 0;
 }
 
@@ -334,6 +372,7 @@
 	AST_TEST_REGISTER(format_joint_same_codec);
 	AST_TEST_REGISTER(format_joint_different_codec);
 	AST_TEST_REGISTER(format_copy);
+	AST_TEST_REGISTER(format_attribute_set_without_interface);
 	return AST_MODULE_LOAD_SUCCESS;
 }
 




More information about the svn-commits mailing list