blob: fb71068cb247771541ff1763921d32aa0be9bb32 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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"));
}
|