#include #include #include #include #include #include #include using namespace Snore; class SnoreBenchmark : public QObject{ Q_OBJECT public: SnoreBenchmark(){ SnoreCore::instance(); } QString htmlTestString = QString("Italic A
" "Italic B
" "Bold
" "Underline
" "Font
" "<&>
" "Website
"); private slots: void benchmarkUtilsToHtml(); void benchmarkUtilsToHtmlAllMarkup(); void benchmarkUtilsToPlain(); }; void SnoreBenchmark::benchmarkUtilsToHtml(){ QCOMPARE(Utils::normaliseMarkup(htmlTestString, Utils::NO_MARKUP), QString("Italic A\n" "Italic B\n" "Bold\n" "Underline\n" "Font\n" "<&>\n" "Website\n")); QCOMPARE(Utils::normaliseMarkup(htmlTestString, Utils::HREF), QString("Italic A\n" "Italic B\n" "Bold\n" "Underline\n" "Font\n" "<&>\n" "Website\n")); QCOMPARE(Utils::normaliseMarkup(htmlTestString, Utils::HREF | Utils::BOLD | Utils::BREAK | Utils::UNDERLINE | Utils::FONT | Utils::ITALIC), htmlTestString); QBENCHMARK{ Utils::normaliseMarkup(htmlTestString, Utils::HREF); } } void SnoreBenchmark::benchmarkUtilsToHtmlAllMarkup() { QCOMPARE(Utils::normaliseMarkup(htmlTestString, Utils::ALL_MARKUP), htmlTestString); QBENCHMARK{ Utils::normaliseMarkup(htmlTestString, Utils::ALL_MARKUP); } } void SnoreBenchmark::benchmarkUtilsToPlain() { QBENCHMARK{ Utils::normaliseMarkup(htmlTestString, Utils::NO_MARKUP); } } QTEST_MAIN(SnoreBenchmark) #include "snorebenchmark.moc"