1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-29 22:36:38 +02:00

tests: add tests on functions weeurl_search_constant and weeurl_search_option

This commit is contained in:
Sébastien Helleu
2023-03-12 08:02:47 +01:00
parent 7ba9f9ac7b
commit b21bc63313
+109
View File
@@ -24,12 +24,121 @@
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)
{
};
/*
* 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