[vlc-devel] commit: test cases for make_URI() ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun May 10 14:27:20 CEST 2009


vlc | branch: 1.0-bugfix | Rémi Denis-Courmont <remi at remlab.net> | Sun May 10 15:24:01 2009 +0300| [d10d2dc0cc90007fa892da4dc0ee2ec69d13bc42] | committer: Rémi Denis-Courmont 

test cases for make_URI()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d10d2dc0cc90007fa892da4dc0ee2ec69d13bc42
---

 src/test/url.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/src/test/url.c b/src/test/url.c
index a097aca..d03e48c 100644
--- a/src/test/url.c
+++ b/src/test/url.c
@@ -29,6 +29,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <assert.h>
 
 typedef char * (*conv_t) (const char *);
 
@@ -60,8 +61,15 @@ static inline void test_b64 (const char *in, const char *out)
     test (vlc_b64_encode, in, out);
 }
 
+static inline void test_path (const char *in, const char *out)
+{
+    test (make_URI, in, out);
+}
+
 int main (void)
 {
+    int val;
+
     (void)setvbuf (stdout, NULL, _IONBF, 0);
     test_decode ("this_should_not_be_modified_1234",
                  "this_should_not_be_modified_1234");
@@ -93,5 +101,24 @@ int main (void)
     test_b64 ("fooba", "Zm9vYmE=");
     test_b64 ("foobar", "Zm9vYmFy");
 
+    /* Path test */
+    test_path ("file:///", "file:///");
+    test_path ("http://www.example.com/%7Ejohn/",
+               "http://www.example.com/%7Ejohn/");
+    test_path ("/", "file:///");
+    test_path ("/home/john/", "file:///home/john/");
+    test_path ("/home/john/music.ogg", "file:///home/john/music.ogg");
+    //test_path ("\\\\server/pub/music.ogg", "file://server/pub/music.ogg");
+
+    /*int fd = open (".", O_RDONLY);
+    assert (fd != -1);*/
+    val = chdir ("/tmp");
+    assert (val != -1);
+    test_path ("movie.ogg", "file:///tmp/movie.ogg");
+    test_path (".", "file:///tmp/.");
+    test_path ("", "file:///tmp/");
+    /*val = fchdir (fd);
+    assert (val != -1);*/
+
     return 0;
 }




More information about the vlc-devel mailing list