aboutsummaryrefslogtreecommitdiff
path: root/plugins/smolblok_hostlist/test/rule.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2020-05-31 21:53:52 +0300
committerAqua-sama <aqua@iserlohn-fortress.net>2020-05-31 21:53:52 +0300
commit737d688e5b173ef5155db3e4fc9e8debf9b33a11 (patch)
tree3fe6cd4aade797fc0c3b18d458834befd43a91cf /plugins/smolblok_hostlist/test/rule.cpp
parentstaging: smolblok (diff)
downloadsmolbote-737d688e5b173ef5155db3e4fc9e8debf9b33a11.tar.xz
enable smolblokstaging-smolblok
Build both HostlistFilter and AdblockFitler plugins by default.
Diffstat (limited to 'plugins/smolblok_hostlist/test/rule.cpp')
-rw-r--r--plugins/smolblok_hostlist/test/rule.cpp57
1 files changed, 0 insertions, 57 deletions
diff --git a/plugins/smolblok_hostlist/test/rule.cpp b/plugins/smolblok_hostlist/test/rule.cpp
deleted file mode 100644
index b5ba6e0..0000000
--- a/plugins/smolblok_hostlist/test/rule.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-#define CATCH_CONFIG_MAIN
-#include "filterlist.h"
-#include <catch2/catch.hpp>
-
-using namespace Hostlist;
-
-SCENARIO("Hostlist::Rule")
-{
- GIVEN("an invalid rule")
- {
- const auto rule = Filterlist::parseRule("0.0.0.0 ");
- REQUIRE(rule.empty());
- }
- GIVEN("127.0.0.1 localhost.localdomain")
- {
- auto rule = Filterlist::parseRule("127.0.0.1 localhost.localdomain");
-
- REQUIRE(!rule.empty());
- REQUIRE(rule.size() == 1);
-
- // note: you need to force it to hash a string, rather than the address itself
- const auto index = qHash(QString("localhost.localdomain"), 0);
- REQUIRE(rule[index].domain == "localhost.localdomain");
- REQUIRE(rule[index].redirect == "127.0.0.1");
- }
-
- GIVEN("0.0.0.0 blockeddomain.com")
- {
- auto rule = Filterlist::parseRule("0.0.0.0 blockeddomain.com");
-
- REQUIRE(!rule.empty());
- REQUIRE(rule.size() == 1);
-
- const auto index = qHash(QString("blockeddomain.com"), 0);
- REQUIRE(rule[index].domain == "blockeddomain.com");
- REQUIRE(rule[index].redirect.isEmpty());
- ;
- }
-
- GIVEN("0.0.0.0 blockeddomain.first blockeddomain.second")
- {
- auto rule = Filterlist::parseRule("0.0.0.0 blockeddomain.first blockeddomain.second");
-
- REQUIRE(!rule.empty());
- REQUIRE(rule.size() == 2);
- {
- const auto index = qHash(QString("blockeddomain.first"), 0);
- REQUIRE(rule[index].domain == "blockeddomain.first");
- REQUIRE(rule[index].redirect.isEmpty());
- }
- {
- const auto index = qHash(QString("blockeddomain.second"), 0);
- REQUIRE(rule[index].domain == "blockeddomain.second");
- REQUIRE(rule[index].redirect.isEmpty());
- }
- }
-}