From 3d2ae07c455c0e423c64f19e445518427a5684fa Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Wed, 9 Jan 2019 19:38:58 +0100 Subject: Rewrite lib/urlfilter - Make HostList and AdBlockList implementations independent from each other - Move urlfilter tests to lib/urlfilter --- test/matcherbenchmark/matcherbenchmark.cpp | 91 ------------------------------ test/matcherbenchmark/matcherbenchmark.h | 20 ------- 2 files changed, 111 deletions(-) delete mode 100644 test/matcherbenchmark/matcherbenchmark.cpp delete mode 100644 test/matcherbenchmark/matcherbenchmark.h (limited to 'test/matcherbenchmark') diff --git a/test/matcherbenchmark/matcherbenchmark.cpp b/test/matcherbenchmark/matcherbenchmark.cpp deleted file mode 100644 index 84406d5..0000000 --- a/test/matcherbenchmark/matcherbenchmark.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include "matcherbenchmark.h" -#include -#include -#include -#include -#include -#include -#include -#include - -void MatcherBenchmark::qstringcontains() -{ - const QString pattern("spamdomain"); - const QString request("subdomain.spamdomain.com"); - - QCOMPARE(request.contains(pattern), true); - QBENCHMARK { - request.contains(pattern); - } -} - -void MatcherBenchmark::qstringmatcher() -{ - const QStringMatcher pattern("spamdomain"); - const QString request("subdomain.spamdomain.com"); - - QCOMPARE(pattern.indexIn(request) != -1, true); - QBENCHMARK { - pattern.indexIn(request); - } -} - -void MatcherBenchmark::qregexp() -{ - const QRegExp pattern("spamdomain"); - const QString request("subdomain.spamdomain.com"); - - QCOMPARE(pattern.indexIn(request) != -1, true); - QBENCHMARK { - pattern.indexIn(request); - } -} - -void MatcherBenchmark::qregularexpressionmatch() -{ - const QRegularExpression pattern("spamdomain"); - const QString request("subdomain.spamdomain.com"); - - QCOMPARE(pattern.match(request).hasMatch(), true); - QBENCHMARK { - pattern.match(request).hasMatch(); - } -} - -void MatcherBenchmark::stdregex() -{ - const std::regex pattern("spamdomain"); - const std::string request("subdomain.spamdomain.com"); - - QCOMPARE(std::regex_search(request, pattern), true); - QBENCHMARK { - std::regex_search(request, pattern); - } -} - -void MatcherBenchmark::cregex() -{ - regex_t pattern; - QCOMPARE(regcomp(&pattern, "spamdomain", 0), 0); - const std::string request("subdomain.spamdomain.com"); - - QCOMPARE(regexec(&pattern, request.c_str(), 0, NULL, 0), false); - QBENCHMARK { - regexec(&pattern, request.c_str(), 0, NULL, 0); - } - - regfree(&pattern); -} - -void MatcherBenchmark::boostregex() -{ - const boost::regex pattern("spamdomain"); - const std::string request("subdomain.spamdomain.com"); - - QCOMPARE(boost::regex_search(request, pattern), true); - QBENCHMARK { - boost::regex_search(request, pattern); - } -} - -QTEST_GUILESS_MAIN(MatcherBenchmark) diff --git a/test/matcherbenchmark/matcherbenchmark.h b/test/matcherbenchmark/matcherbenchmark.h deleted file mode 100644 index deb4495..0000000 --- a/test/matcherbenchmark/matcherbenchmark.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef MATCHER_BENCHMARK -#define MATCHER_BENCHMARK - -#include - -class MatcherBenchmark : public QObject -{ - Q_OBJECT - -private slots: - void qstringcontains(); - void qstringmatcher(); - void qregexp(); - void qregularexpressionmatch(); - void stdregex(); - void cregex(); - void boostregex(); -}; - -#endif -- cgit v1.2.1