test (vlc_b64_encode, in, out);
}
+static char *make_URI_def (const char *in)
+{
+ return make_URI (in, NULL);
+}
+
static inline void test_path (const char *in, const char *out)
{
- test (make_URI, in, out);
+ test (make_URI_def, in, out);
}
static inline void test_current_directory_path (const char *in, const char *cwd, const char *out)
int val = asprintf(&expected_result, "file://%s/%s", cwd, out);
assert (val != -1);
- test (make_URI, in, expected_result);
+ test (make_URI_def, in, expected_result);
}
int main (void)
test_decode ("this_should_not_be_modified_1234",
"this_should_not_be_modified_1234");
- test_decode ("This+should+be+modified+1234!",
- "This should be modified 1234!");
-
test_decode ("This%20should%20be%20modified%201234!",
"This should be modified 1234!");
test_decode ("%2", "%2");
test_decode ("%0000", "");
- /* UTF-8 tests */
- test_decode ("T%C3%a9l%c3%A9vision+%e2%82%Ac", "Télévision €");
- test_decode ("T%E9l%E9vision", "T?l?vision");
- test_decode ("%C1%94%C3%a9l%c3%A9vision", "??élévision"); /* overlong */
+ /* Non-ASCII tests */
+ test_decode ("T%C3%a9l%c3%A9vision %e2%82%Ac", "Télévision €");
+ test_decode ("T%E9l%E9vision", "T\xe9l\xe9vision");
/* Base 64 tests */
test_b64 ("", "");
test_path ("/home/john/music.ogg", "file:///home/john/music.ogg");
test_path ("\\\\server/pub/music.ogg", "smb://server/pub/music.ogg");
test_path ("\\\\server\\pub\\music.ogg", "smb://server/pub/music.ogg");
+ test_path ("\\\\server", "smb://server");
/*int fd = open (".", O_RDONLY);
assert (fd != -1);*/
/*val = fchdir (fd);
assert (val != -1);*/
+ /* URI to path tests */
+#define test( a, b ) test (make_path, a, b)
+ test ("mailto:john@example.com", NULL);
+ test ("http://www.example.com/file.html#ref", NULL);
+ test ("file://", NULL);
+ test ("file:///", "/");
+ test ("file://localhost/home/john/music%2Eogg", "/home/john/music.ogg");
+ test ("file://localhost/home/john/text#ref", "/home/john/text");
+ test ("fd://0foobar", NULL);
+ test ("fd://0#ref", "/dev/stdin");
+ test ("fd://1", "/dev/stdout");
+ test ("fd://12345", "/dev/fd/12345");
+#undef test
+
return 0;
}