[vlc-devel] [PATCH 2/2] tests: Check b_ipv6

Hugo Beauzée-Luyssen hugo at beauzee.fr
Mon May 23 13:59:06 CEST 2016


---
 src/test/url.c | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/src/test/url.c b/src/test/url.c
index 0f40c34..3a82d7a 100644
--- a/src/test/url.c
+++ b/src/test/url.c
@@ -90,7 +90,7 @@ static inline void test_current_directory_path (const char *in, const char *cwd,
 
 static void test_url_parse(const char* in, const char* protocol, const char* user,
                            const char* pass, const char* host, unsigned i_port,
-                           const char* path, const char* option )
+                           const char* path, const char* option, bool b_ipv6 )
 {
 #define CHECK( a, b ) \
     if (a == NULL) \
@@ -107,6 +107,7 @@ static void test_url_parse(const char* in, const char* protocol, const char* use
     CHECK( url.psz_path, path );
     assert( url.i_port == i_port );
     CHECK( url.psz_option, option );
+    assert( url.b_ipv6 == b_ipv6 );
 
     vlc_UrlClean( &url );
 
@@ -187,24 +188,24 @@ int main (void)
 #undef test
 
     test_url_parse("http://example.com", "http", NULL, NULL, "example.com", 0,
-                   NULL, NULL);
+                   NULL, NULL, false);
     test_url_parse("http://example.com/", "http", NULL, NULL, "example.com", 0,
-                   "/", NULL);
+                   "/", NULL, false);
     test_url_parse("http://[2001:db8::1]", "http", NULL, NULL, "2001:db8::1",
-                   0, NULL, NULL);
-    test_url_parse("protocol://john:doe@1.2.3.4:567", "protocol", "john", "doe", "1.2.3.4", 567, NULL, NULL);
-    test_url_parse("http://a.b/?opt=val", "http", NULL, NULL, "a.b", 0, "/", "opt=val");
-    test_url_parse("p://u:p@host:123/a/b/c?o=v", "p", "u", "p", "host", 123, "/a/b/c", "o=v");
-    test_url_parse("p://?o=v", "p", NULL, NULL, "", 0, NULL, "o=v");
-    test_url_parse("p://h?o=v", "p", NULL, NULL, "h", 0, NULL, "o=v");
-    test_url_parse("p://h:123?o=v", "p", NULL, NULL, "h", 123, NULL, "o=v");
-    test_url_parse("p://u:p@h:123?o=v", "p", "u", "p", "h", 123, NULL, "o=v");
+                   0, NULL, NULL, true);
+    test_url_parse("protocol://john:doe@1.2.3.4:567", "protocol", "john", "doe", "1.2.3.4", 567, NULL, NULL, false);
+    test_url_parse("http://a.b/?opt=val", "http", NULL, NULL, "a.b", 0, "/", "opt=val", false);
+    test_url_parse("p://u:p@host:123/a/b/c?o=v", "p", "u", "p", "host", 123, "/a/b/c", "o=v", false);
+    test_url_parse("p://?o=v", "p", NULL, NULL, "", 0, NULL, "o=v", false);
+    test_url_parse("p://h?o=v", "p", NULL, NULL, "h", 0, NULL, "o=v", false);
+    test_url_parse("p://h:123?o=v", "p", NULL, NULL, "h", 123, NULL, "o=v", false);
+    test_url_parse("p://u:p@h:123?o=v", "p", "u", "p", "h", 123, NULL, "o=v", false);
     test_url_parse("p://white%20spaced", "p", NULL, NULL, "white%20spaced", 0,
-                   NULL, NULL);
+                   NULL, NULL, false);
     test_url_parse("p://h/white%20spaced", "p", NULL, NULL, "h", 0,
-                   "/white%20spaced", NULL);
+                   "/white%20spaced", NULL, false);
     /* Invalid URIs */
-    test_url_parse("p://G a r b a g e", "p", NULL, NULL, NULL, 0, NULL, NULL);
-    test_url_parse("p://h/G a r b a g e", "p", NULL, NULL, "h", 0, NULL, NULL);
+    test_url_parse("p://G a r b a g e", "p", NULL, NULL, NULL, 0, NULL, NULL, false);
+    test_url_parse("p://h/G a r b a g e", "p", NULL, NULL, "h", 0, NULL, NULL, false);
     return 0;
 }
-- 
2.8.1



More information about the vlc-devel mailing list