- Timestamp:
- 2006-12-24T21:47:18Z (18 years ago)
- Branches:
- master
- Children:
- ed5df81
- Parents:
- c227706
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/check_util.c
rc227706 r7bee5af 7 7 #include "set.h" 8 8 #include "misc.h" 9 #include "url.h" 9 10 10 11 START_TEST(test_strip_linefeed) … … 43 44 END_TEST 44 45 46 START_TEST(test_set_url_http) 47 url_t url; 48 49 fail_if (0 == url_set(&url, "http://host/")); 50 fail_unless (!strcmp(url.host, "host")); 51 fail_unless (!strcmp(url.file, "/")); 52 fail_unless (!strcmp(url.user, "")); 53 fail_unless (!strcmp(url.pass, "")); 54 fail_unless (url.proto == PROTO_HTTP); 55 fail_unless (url.port == 80); 56 END_TEST 57 58 START_TEST(test_set_url_https) 59 url_t url; 60 61 fail_if (0 == url_set(&url, "https://ahost/AimeeMann")); 62 fail_unless (!strcmp(url.host, "ahost")); 63 fail_unless (!strcmp(url.file, "/AimeeMann")); 64 fail_unless (!strcmp(url.user, "")); 65 fail_unless (!strcmp(url.pass, "")); 66 fail_unless (url.proto == PROTO_HTTPS); 67 fail_unless (url.port == 443); 68 END_TEST 69 70 START_TEST(test_set_url_port) 71 url_t url; 72 73 fail_if (0 == url_set(&url, "https://ahost:200/Lost/In/Space")); 74 fail_unless (!strcmp(url.host, "ahost")); 75 fail_unless (!strcmp(url.file, "/Lost/In/Space")); 76 fail_unless (!strcmp(url.user, "")); 77 fail_unless (!strcmp(url.pass, "")); 78 fail_unless (url.proto == PROTO_HTTPS); 79 fail_unless (url.port == 200); 80 END_TEST 81 82 START_TEST(test_set_url_username) 83 url_t url; 84 85 fail_if (0 == url_set(&url, "socks4://user@ahost/Space")); 86 fail_unless (!strcmp(url.host, "ahost")); 87 fail_unless (!strcmp(url.file, "/Space")); 88 fail_unless (!strcmp(url.user, "user")); 89 fail_unless (!strcmp(url.pass, "")); 90 fail_unless (url.proto == PROTO_SOCKS4); 91 fail_unless (url.port == 1080); 92 END_TEST 93 94 START_TEST(test_set_url_username_pwd) 95 url_t url; 96 97 fail_if (0 == url_set(&url, "socks5://user:pass@ahost/")); 98 fail_unless (!strcmp(url.host, "ahost")); 99 fail_unless (!strcmp(url.file, "/")); 100 fail_unless (!strcmp(url.user, "user")); 101 fail_unless (!strcmp(url.pass, "pass")); 102 fail_unless (url.proto == PROTO_SOCKS5); 103 fail_unless (url.port == 1080); 104 END_TEST 105 45 106 Suite *util_suite (void) 46 107 { … … 50 111 tcase_add_test (tc_core, test_strip_linefeed); 51 112 tcase_add_test (tc_core, test_strip_newlines); 113 tcase_add_test (tc_core, test_set_url_http); 114 tcase_add_test (tc_core, test_set_url_https); 115 tcase_add_test (tc_core, test_set_url_port); 116 tcase_add_test (tc_core, test_set_url_username); 117 tcase_add_test (tc_core, test_set_url_username_pwd); 52 118 return s; 53 119 }
Note: See TracChangeset
for help on using the changeset viewer.