summaryrefslogtreecommitdiffstats
path: root/tools/linguist/tests/tst_simtexth.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2009-03-23 09:18:55 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-03-23 09:18:55 (GMT)
commite5fcad302d86d316390c6b0f62759a067313e8a9 (patch)
treec2afbf6f1066b6ce261f14341cf6d310e5595bc1 /tools/linguist/tests/tst_simtexth.cpp
downloadQt-e5fcad302d86d316390c6b0f62759a067313e8a9.zip
Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.gz
Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.bz2
Long live Qt 4.5!
Diffstat (limited to 'tools/linguist/tests/tst_simtexth.cpp')
-rw-r--r--tools/linguist/tests/tst_simtexth.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/tools/linguist/tests/tst_simtexth.cpp b/tools/linguist/tests/tst_simtexth.cpp
new file mode 100644
index 0000000..81a7f19
--- /dev/null
+++ b/tools/linguist/tests/tst_simtexth.cpp
@@ -0,0 +1,43 @@
+
+/****************************************************************************
+ **
+ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+ **
+ ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ **
+ ****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtCore/QtCore>
+
+//int getSimilarityScore(const QString &str1, const char* str2);
+#include "../shared/simtexth.h"
+#include "tst_linguist.h"
+
+void tst_linguist::simtexth()
+{
+ QFETCH(QString, one);
+ QFETCH(QString, two);
+ QFETCH(int, expected);
+
+ int measured = getSimilarityScore(one, two.toLatin1());
+ QCOMPARE(measured, expected);
+}
+
+
+void tst_linguist::simtexth_data()
+{
+ using namespace QTest;
+
+ addColumn<QString>("one");
+ addColumn<QString>("two");
+ addColumn<int>("expected");
+
+ newRow("00") << "" << "" << 1024;
+ newRow("01") << "a" << "a" << 1024;
+ newRow("02") << "ab" << "ab" << 1024;
+ newRow("03") << "abc" << "abc" << 1024;
+ newRow("04") << "abcd" << "abcd" << 1024;
+}