diff options
author | dvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-02-10 23:13:49 +0000 |
---|---|---|
committer | dvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-02-10 23:13:49 +0000 |
commit | bb96c2af4a28c2794f68266567f207d23e956aaa (patch) | |
tree | 20dc37fcf8e82b72211e163c50327b43ca6a0e49 /channels/sip/reqresp_parser.c | |
parent | 965e087bf8d2536ed16b21aedde7e2da1fd44894 (diff) |
additional parse_uri test and documentation
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@246249 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/sip/reqresp_parser.c')
-rw-r--r-- | channels/sip/reqresp_parser.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/channels/sip/reqresp_parser.c b/channels/sip/reqresp_parser.c index fe6ce0e1c..3697e7633 100644 --- a/channels/sip/reqresp_parser.c +++ b/channels/sip/reqresp_parser.c @@ -123,6 +123,10 @@ AST_TEST_DEFINE(sip_parse_uri_test) char uri2[] = "sip:name@host;transport=tcp"; char uri3[] = "sip:name:secret@host;transport=tcp"; char uri4[] = "sip:name:secret@host:port;transport=tcp?headers=%40%40testblah&headers2=blah%20blah"; + /* test 5 is for NULL input */ + char uri6[] = "sip:name:secret@host:port;transport=tcp?headers=%40%40testblah&headers2=blah%20blah"; + char uri7[] = "sip:name:secret@host:port;transport=tcp?headers=%40%40testblah&headers2=blah%20blah"; + switch (cmd) { case TEST_INIT: info->name = "sip_uri_parse_test"; @@ -193,11 +197,20 @@ AST_TEST_DEFINE(sip_parse_uri_test) /* Test 6, verify parse_uri does not crash when given a NULL output parameters */ name = pass = domain = port = transport = NULL; - if (parse_uri(uri4, "sip:,sips:", NULL, NULL, NULL, NULL, NULL)) { + if (parse_uri(uri6, "sip:,sips:", NULL, NULL, NULL, NULL, NULL)) { ast_test_status_update(test, "Test 6: passing NULL output parameters failed.\n"); res = AST_TEST_FAIL; } + /* Test 7, verify parse_uri returns user:secret and domain:port when no port or secret output parameters are supplied. */ + name = pass = domain = port = transport = NULL; + if (parse_uri(uri7, "sip:,sips:", &name, NULL, &domain, NULL, NULL) || + strcmp(name, "name:secret") || + strcmp(domain, "host:port")) { + + ast_test_status_update(test, "Test 7: providing no port and secret output parameters failed.\n"); + res = AST_TEST_FAIL; + } return res; } |