#include #include "catch2/catch_test_macros.hpp" #include "catch2/generators/catch_generators.hpp" #include #include #ifdef CURL_FOUND TEST_CASE("URI") { auto scheme = GENERATE("irc", "ircs"); auto i = GENERATE("%23channame", "%23channame,ischannel", "#channame", "#channame,ischannel"); const std::string input = std::string(scheme) + "://irc.example.com/" + std::string(i); IrcUri uri(input); CHECK(uri.get_server() == "irc.example.com"); CHECK(uri.get_entity() == "#channame"); } #else TEST_CASE("No CURL") { auto scheme = GENERATE("irc", "ircs"); auto i = GENERATE("%23channame", "%23channame,ischannel", "#channame", "#channame,ischannel"); const std::string input = std::string(scheme) + "://irc.example.com/" + std::string(i); IrcUri uri(input); CHECK(uri.get_server() == std::nullopt); CHECK(uri.get_entity() == std::nullopt); } #endif // CURL_FOUND