diff options
Diffstat (limited to 'test/adblock')
-rw-r--r-- | test/adblock/adblocktest.cpp | 14 | ||||
-rw-r--r-- | test/adblock/adblocktest.h | 4 |
2 files changed, 8 insertions, 10 deletions
diff --git a/test/adblock/adblocktest.cpp b/test/adblock/adblocktest.cpp index b31d965..f4d9ce2 100644 --- a/test/adblock/adblocktest.cpp +++ b/test/adblock/adblocktest.cpp @@ -1,18 +1,14 @@ #include "adblocktest.h" #include <QtTest/QtTest> -#include "filterrule.h" #include "formats/adblockrule.h" -inline bool check(const std::vector<AdBlockRule> rules, const QUrl &url) +void AdBlockTest::parseRule() { - for(const AdBlockRule &rule : rules) { - if(rule.matchesDomain(qHash(url.host())) && rule.matchesUrl(url)) - return true; - } - return false; + FilterLeaf *rule = loadRule("spamdomain"); + QCOMPARE(rule != nullptr, true); } -void AdBlockTest::parseList() +/*void AdBlockTest::parseList() { std::vector<AdBlockRule> rules; @@ -60,6 +56,6 @@ void AdBlockTest::parseList() QCOMPARE(check(rules, QUrl("http://another.com/banner123")), true); QCOMPARE(check(rules, QUrl("http://another.com/banner321")), true); QCOMPARE(check(rules, QUrl("http://another.com/banners")), false); -} +}*/ QTEST_GUILESS_MAIN(AdBlockTest) diff --git a/test/adblock/adblocktest.h b/test/adblock/adblocktest.h index 95cb7e2..7e58197 100644 --- a/test/adblock/adblocktest.h +++ b/test/adblock/adblocktest.h @@ -2,12 +2,14 @@ #define ADBLOCKTEST_H #include <QObject> + class AdBlockTest : public QObject { Q_OBJECT private slots: - void parseList(); + void parseRule(); + //void parseList(); }; #endif // ADBLOCKTEST_H |