[asterisk-commits] file: branch group/media_formats r406916 - /team/group/media_formats/tests/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 29 11:27:41 CST 2014


Author: file
Date: Wed Jan 29 11:27:29 2014
New Revision: 406916

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=406916
Log:
SDP parsing on a format without an interface can't work.

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=406916&r1=406915&r2=406916
==============================================================================
--- team/group/media_formats/tests/test_core_format.c (original)
+++ team/group/media_formats/tests/test_core_format.c Wed Jan 29 11:27:29 2014
@@ -346,6 +346,43 @@
 
 	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;
+	}
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(format_sdp_parse_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_sdp_parse_without_interface";
+		info->category = "/main/core_format/";
+		info->summary = "format sdp parse unit test";
+		info->description =
+			"Test that sdp parsing 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_sdp_parse(format, "tacos")) {
+		ast_test_status_update(test, "Successfully parsed SDP on a format without an interface\n");
 		return AST_TEST_FAIL;
 	}
 
@@ -361,6 +398,7 @@
 	AST_TEST_UNREGISTER(format_joint_different_codec);
 	AST_TEST_UNREGISTER(format_copy);
 	AST_TEST_UNREGISTER(format_attribute_set_without_interface);
+	AST_TEST_UNREGISTER(format_sdp_parse_without_interface);
 	return 0;
 }
 
@@ -373,6 +411,7 @@
 	AST_TEST_REGISTER(format_joint_different_codec);
 	AST_TEST_REGISTER(format_copy);
 	AST_TEST_REGISTER(format_attribute_set_without_interface);
+	AST_TEST_REGISTER(format_sdp_parse_without_interface);
 	return AST_MODULE_LOAD_SUCCESS;
 }
 




More information about the asterisk-commits mailing list