diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-04-20 13:29:06 +0300 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-04-21 20:14:58 +0300 |
commit | 8d484d153dd054be89be51b7b4e9815450c0065a (patch) | |
tree | 44a4c1045969909197312003957611f90d9be582 /subprojects/plugin_hostlist/test/filterlist.cpp | |
parent | Add plugin loading code to smolblok (diff) | |
download | smolbote-8d484d153dd054be89be51b7b4e9815450c0065a.tar.xz |
Move staging/hostlist to subprojects/plugin_hostlist
Diffstat (limited to 'subprojects/plugin_hostlist/test/filterlist.cpp')
-rw-r--r-- | subprojects/plugin_hostlist/test/filterlist.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/subprojects/plugin_hostlist/test/filterlist.cpp b/subprojects/plugin_hostlist/test/filterlist.cpp new file mode 100644 index 0000000..fb71068 --- /dev/null +++ b/subprojects/plugin_hostlist/test/filterlist.cpp @@ -0,0 +1,29 @@ +#define CATCH_CONFIG_MAIN +#include "filterlist.hpp" +#include <QFile> +#include <catch2/catch.hpp> + +using namespace Hostlist; + +TEST_CASE("Hostlist") +{ + Filterlist list; + + const QString filename(qgetenv("HOSTLIST_TXT")); + REQUIRE(!filename.isEmpty()); + + QFile f(filename); + REQUIRE(f.open(QIODevice::ReadOnly | QIODevice::Text)); + + REQUIRE(list.load(f)); + f.close(); + + REQUIRE(list.count() == 4); + + REQUIRE(list.findMatch("blockeddomain.first")); + REQUIRE(list.findMatch("blockeddomain.second")); + + REQUIRE(list.findMatch("localhost.localdomain")); + + REQUIRE(!list.findMatch("other.domain")); +} |