diff options
-rw-r--r-- | tests/unit/core/test-core-url.cpp | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/tests/unit/core/test-core-url.cpp b/tests/unit/core/test-core-url.cpp index 049100afb..e3aaa25db 100644 --- a/tests/unit/core/test-core-url.cpp +++ b/tests/unit/core/test-core-url.cpp @@ -24,6 +24,12 @@ extern "C" { #include "src/core/wee-url.h" + +extern struct t_url_constant url_proxy_types[]; +extern struct t_url_constant url_protocols[]; +extern int weeurl_search_constant (struct t_url_constant *constants, + const char *name); +extern int weeurl_search_option (const char *name); } TEST_GROUP(CoreUrl) @@ -32,6 +38,109 @@ TEST_GROUP(CoreUrl) /* * Tests functions: + * weeurl_search_constant + */ + +TEST(CoreUrl, SearchConstant) +{ + LONGS_EQUAL(-1, weeurl_search_constant (NULL, NULL)); + LONGS_EQUAL(-1, weeurl_search_constant (NULL, "")); + LONGS_EQUAL(-1, weeurl_search_constant (NULL, "test")); + LONGS_EQUAL(-1, weeurl_search_constant (url_proxy_types, NULL)); + LONGS_EQUAL(-1, weeurl_search_constant (url_proxy_types, "")); + LONGS_EQUAL(-1, weeurl_search_constant (url_proxy_types, "does_not_exist")); + + CHECK(weeurl_search_constant (url_proxy_types, "socks4") >= 0); + CHECK(weeurl_search_constant (url_proxy_types, "SOCKS4") >= 0); + + CHECK(weeurl_search_constant (url_protocols, "https") >= 0); + CHECK(weeurl_search_constant (url_protocols, "HTTPS") >= 0); +} + +/* + * Tests functions: + * weeurl_get_mask_value + */ + +TEST(CoreUrl, GetMaskValue) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * weeurl_search_option + */ + +TEST(CoreUrl, SearchOption) +{ + LONGS_EQUAL(-1, weeurl_search_option (NULL)); + LONGS_EQUAL(-1, weeurl_search_option ("")); + LONGS_EQUAL(-1, weeurl_search_option ("does_not_exist")); + + /* string */ + CHECK(weeurl_search_option ("interface") >= 0); + CHECK(weeurl_search_option ("INTERFACE") >= 0); + + /* long */ + CHECK(weeurl_search_option ("proxyport") >= 0); + CHECK(weeurl_search_option ("PROXYPORT") >= 0); + + /* long long */ + CHECK(weeurl_search_option ("resume_from_large") >= 0); + CHECK(weeurl_search_option ("RESUME_FROM_LARGE") >= 0); + + /* list */ + CHECK(weeurl_search_option ("httpheader") >= 0); + CHECK(weeurl_search_option ("HTTPHEADER") >= 0); + + /* mask */ + CHECK(weeurl_search_option ("httpauth") >= 0); + CHECK(weeurl_search_option ("HTTPAUTH") >= 0); +} + +/* + * Tests functions: + * weeurl_read + */ + +TEST(CoreUrl, Read) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * weeurl_write + */ + +TEST(CoreUrl, Write) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * weeurl_option_map_cb + */ + +TEST(CoreUrl, OptionMapCb) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * weeurl_set_proxy + */ + +TEST(CoreUrl, SetProxy) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: * weeurl_download */ |