[svn-commits] dvossel: branch dvossel/sip_string_parse_testing r244059 - /team/dvossel/sip_...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Sat Jan 30 01:38:10 CST 2010
Author: dvossel
Date: Sat Jan 30 01:38:07 2010
New Revision: 244059
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=244059
Log:
fixes bug in parse_uri unit test
Modified:
team/dvossel/sip_string_parse_testing/channels/sip/request-parser.c
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=244059&r1=244058&r2=244059
==============================================================================
--- 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:38:07 2010
@@ -127,9 +127,9 @@
{
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";
+ 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:
@@ -146,40 +146,41 @@
/* Test 1, simple URI */
name = pass = domain = port = options = transport = NULL;
- if (parse_uri(uri1, "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, "")) {
-
- ast_str_append(&args->ast_test_error_str, 0, "Test 1: simple uri failed. %s\n", uri1);
+ if (parse_uri(uri1, "sip:,sips:", &name, &pass, &domain, &port, &options, &transport) ||
+ strcmp(name, "name") ||
+ !ast_strlen_zero(pass) ||
+ strcmp(domain, "domain") ||
+ !ast_strlen_zero(options) ||
+ !ast_strlen_zero(transport)) {
+//TODO options and name are the same value right now. how is this correct?!
+ ast_log(LOG_NOTICE, "name %s domain %s pass %s port %s options %s transport %s\n",name, domain, pass, port, options, transport);
+ ast_str_append(&args->ast_test_error_str, 0, "Test 1: simple uri failed. \n");
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")) {
+ if (parse_uri(uri2, "sip:,sips:", &name, &pass, &domain, &port, &options, &transport) ||
+ strcmp(name, "name") ||
+ !ast_strlen_zero(pass) ||
+ strcmp(domain, "domain") ||
+ !ast_strlen_zero(options) ||
+ strcmp(transport, "tcp")) {
- ast_str_append(&args->ast_test_error_str, 0, "Test 1: uri with addtion of tcp transport failed. %s\n", uri2);
+ ast_str_append(&args->ast_test_error_str, 0, "Test 2: uri with addtion of tcp transport failed. \n");
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")) {
+ if (parse_uri(uri3, "sip:,sips:", &name, &pass, &domain, &port, &options, &transport) ||
+ strcmp(name, "name") ||
+ strcmp(pass, "secret") ||
+ strcmp(domain, "domain") ||
+ !ast_strlen_zero(options) ||
+ strcmp(transport, "tcp")) {
- ast_str_append(&args->ast_test_error_str, 0, "Test 1: uri with addition of secret failed. %s\n", uri3);
+ ast_str_append(&args->ast_test_error_str, 0, "Test 3: uri with addition of secret failed.\n");
res = AST_TEST_FAIL;
}
More information about the svn-commits
mailing list