[svn-commits] dvossel: branch dvossel/sip_string_parse_testing r244058 - in /team/dvossel/s...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sat Jan 30 01:06:51 CST 2010


Author: dvossel
Date: Sat Jan 30 01:06:47 2010
New Revision: 244058

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=244058
Log:
update for parse_uri unit test 

Modified:
    team/dvossel/sip_string_parse_testing/channels/chan_sip.c
    team/dvossel/sip_string_parse_testing/channels/sip/config-parser.c
    team/dvossel/sip_string_parse_testing/channels/sip/request-parser.c
    team/dvossel/sip_string_parse_testing/channels/sip/sip.h

Modified: team/dvossel/sip_string_parse_testing/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/sip_string_parse_testing/channels/chan_sip.c?view=diff&rev=244058&r1=244057&r2=244058
==============================================================================
--- team/dvossel/sip_string_parse_testing/channels/chan_sip.c (original)
+++ team/dvossel/sip_string_parse_testing/channels/chan_sip.c Sat Jan 30 01:06:47 2010
@@ -25459,14 +25459,16 @@
 static void sip_register_tests(void)
 {
 	AST_TEST_REGISTER(get_calleridname_test);
-	sip_config_register_tests();
+	sip_config_parser_register_tests();
+	sip_request_parser_register_tests();
 }
 
 /*! \brief SIP test registration */
 static void sip_unregister_tests(void)
 {
 	AST_TEST_UNREGISTER(get_calleridname_test);
-	sip_config_unregister_tests();
+	sip_config_parser_unregister_tests();
+	sip_request_parser_unregister_tests();
 }
 
 /*! \brief PBX load module - initialization */

Modified: team/dvossel/sip_string_parse_testing/channels/sip/config-parser.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/sip_string_parse_testing/channels/sip/config-parser.c?view=diff&rev=244058&r1=244057&r2=244058
==============================================================================
--- team/dvossel/sip_string_parse_testing/channels/sip/config-parser.c (original)
+++ team/dvossel/sip_string_parse_testing/channels/sip/config-parser.c Sat Jan 30 01:06:47 2010
@@ -460,13 +460,13 @@
 }
 
 /*! \brief SIP test registration */
-void sip_config_register_tests(void)
+void sip_config_parser_register_tests(void)
 {
 	AST_TEST_REGISTER(sip_parse_register_line_test);
 }
 
 /*! \brief SIP test registration */
-void sip_config_unregister_tests(void)
+void sip_config_parser_unregister_tests(void)
 {
 	AST_TEST_UNREGISTER(sip_parse_register_line_test);
 }

Modified: team/dvossel/sip_string_parse_testing/channels/sip/request-parser.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/sip_string_parse_testing/channels/sip/request-parser.c?view=diff&rev=244058&r1=244057&r2=244058
==============================================================================
--- team/dvossel/sip_string_parse_testing/channels/sip/request-parser.c (original)
+++ team/dvossel/sip_string_parse_testing/channels/sip/request-parser.c Sat Jan 30 01:06:47 2010
@@ -128,6 +128,8 @@
 	int res = AST_TEST_PASS;
 	char *name, *pass, *domain, *port, *options, *transport;
 	char *uri1 = "sip:name at domain";
+	char *uri2 = "sip:name at domain;transport=tcp";
+	char *uri3 = "sip:name:secret at domain;transport=tcp";
 
 	switch (cmd) {
 	case TEST_INIT:
@@ -155,6 +157,40 @@
 		res = AST_TEST_FAIL;
 	}
 
+	/* Test 2, add tcp transport */
+	name = pass = domain = port = options = transport = NULL;
+	if (parse_uri(uri2, "sip:sips:", &name, &pass, &domain, &port, &options, &transport) ||
+		ast_strlen_zero(name)      || strcmp(name, "name")        ||
+		ast_strlen_zero(pass)      || strcmp(pass, "")            ||
+		ast_strlen_zero(domain)    || strcmp(domain, "domain")    ||
+		ast_strlen_zero(options)   || strcmp(options, "")         ||
+		ast_strlen_zero(transport) || strcmp(transport, "tcp")) {
+
+		ast_str_append(&args->ast_test_error_str, 0, "Test 1: uri with addtion of tcp transport failed. %s\n", uri2);
+		res = AST_TEST_FAIL;
+	}
+
+	/* Test 3, add secret */
+	name = pass = domain = port = options = transport = NULL;
+	if (parse_uri(uri3, "sip:sips:", &name, &pass, &domain, &port, &options, &transport) ||
+		ast_strlen_zero(name)      || strcmp(name, "name")        ||
+		ast_strlen_zero(pass)      || strcmp(pass, "secret")      ||
+		ast_strlen_zero(domain)    || strcmp(domain, "domain")    ||
+		ast_strlen_zero(options)   || strcmp(options, "")         ||
+		ast_strlen_zero(transport) || strcmp(transport, "tcp")) {
+
+		ast_str_append(&args->ast_test_error_str, 0, "Test 1: uri with addition of secret failed. %s\n", uri3);
+		res = AST_TEST_FAIL;
+	}
+
 	return res;
 }
 
+void sip_request_parser_register_tests(void)
+{
+	AST_TEST_REGISTER(sip_parse_uri_test);
+}
+void sip_request_parser_unregister_tests(void)
+{
+	AST_TEST_UNREGISTER(sip_parse_uri_test);
+}

Modified: team/dvossel/sip_string_parse_testing/channels/sip/sip.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/sip_string_parse_testing/channels/sip/sip.h?view=diff&rev=244058&r1=244057&r2=244058
==============================================================================
--- team/dvossel/sip_string_parse_testing/channels/sip/sip.h (original)
+++ team/dvossel/sip_string_parse_testing/channels/sip/sip.h Sat Jan 30 01:06:47 2010
@@ -1290,11 +1290,11 @@
  */
 int sip_parse_register_line(struct sip_registry *reg, const char *value, int lineno);
 
-/*! \brief registration parsing tests */
-void sip_config_register_tests(void);
-
-/*! \brief unregistration parsing tests */
-void sip_config_unregister_tests(void);
+/*! \brief register config parsing tests */
+void sip_config_parser_register_tests(void);
+
+/*! \brief unregister config parsing tests */
+void sip_config_parser_unregister_tests(void);
 
 /* ------------------- request-parser.c ------------------- */
 
@@ -1319,6 +1319,12 @@
  */
 int parse_uri(char *uri, const char *scheme, char **ret_name, char **pass, char **domain, char **port, char **options, char **transport);
 
+/*! \brief register request parsing tests */
+void sip_request_parser_register_tests(void);
+
+/*! \brief unregister request parsing tests */
+void sip_request_parser_unregister_tests(void);
+
 /* ------------------- shared sip utils ------------------- */
 
 /*! \brief converts ascii port to int representation. If no




More information about the svn-commits mailing list