summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qmap/tst_qmap.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-10-13 16:38:01 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-10-14 08:32:42 +0000
commitf0a559f1c8dcf4b78c11853316919783823ded7a (patch)
treed5199ce97c70001b7db6cbba4082d8699c90abaf /tests/auto/corelib/tools/qmap/tst_qmap.cpp
parenta2a00eb044596f3e3f628b6b20b38a5ba524915c (diff)
Tests: Use QCOMPARE() with QLatin1String() for QString values.
Prefer QCOMPARE over QVERIFY for equality and use QLatin1String(). Change-Id: If226a0fc7b25be3e6774c7e36ca1e6f99234e5dd Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Diffstat (limited to 'tests/auto/corelib/tools/qmap/tst_qmap.cpp')
-rw-r--r--tests/auto/corelib/tools/qmap/tst_qmap.cpp68
1 files changed, 34 insertions, 34 deletions
diff --git a/tests/auto/corelib/tools/qmap/tst_qmap.cpp b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
index bb6535b635..7cd7d7980f 100644
--- a/tests/auto/corelib/tools/qmap/tst_qmap.cpp
+++ b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
@@ -413,24 +413,24 @@ void tst_QMap::key()
QCOMPARE(map1.key(1, def), def);
map1.insert("one", 1);
- QCOMPARE(map1.key(1), QString("one"));
- QCOMPARE(map1.key(1, def), QString("one"));
+ QCOMPARE(map1.key(1), QLatin1String("one"));
+ QCOMPARE(map1.key(1, def), QLatin1String("one"));
QCOMPARE(map1.key(2), QString());
QCOMPARE(map1.key(2, def), def);
map1.insert("two", 2);
- QCOMPARE(map1.key(1), QString("one"));
- QCOMPARE(map1.key(1, def), QString("one"));
- QCOMPARE(map1.key(2), QString("two"));
- QCOMPARE(map1.key(2, def), QString("two"));
+ QCOMPARE(map1.key(1), QLatin1String("one"));
+ QCOMPARE(map1.key(1, def), QLatin1String("one"));
+ QCOMPARE(map1.key(2), QLatin1String("two"));
+ QCOMPARE(map1.key(2, def), QLatin1String("two"));
QCOMPARE(map1.key(3), QString());
QCOMPARE(map1.key(3, def), def);
map1.insert("deux", 2);
- QCOMPARE(map1.key(1), QString("one"));
- QCOMPARE(map1.key(1, def), QString("one"));
- QVERIFY(map1.key(2) == "deux" || map1.key(2) == "two");
- QVERIFY(map1.key(2, def) == "deux" || map1.key(2, def) == "two");
+ QCOMPARE(map1.key(1), QLatin1String("one"));
+ QCOMPARE(map1.key(1, def), QLatin1String("one"));
+ QVERIFY(map1.key(2) == QLatin1String("deux") || map1.key(2) == QLatin1String("two"));
+ QVERIFY(map1.key(2, def) == QLatin1String("deux") || map1.key(2, def) == QLatin1String("two"));
QCOMPARE(map1.key(3), QString());
QCOMPARE(map1.key(3, def), def);
}
@@ -608,8 +608,8 @@ void tst_QMap::find()
map1.insert(1,"Mayer");
map1.insert(2,"Hej");
- QVERIFY(map1.find(1).value() == "Mayer");
- QVERIFY(map1.find(2).value() == "Hej");
+ QCOMPARE(map1.find(1).value(), QLatin1String("Mayer"));
+ QCOMPARE(map1.find(2).value(), QLatin1String("Hej"));
for(i = 3; i < 10; ++i) {
compareString = testString.arg(i);
@@ -643,8 +643,8 @@ void tst_QMap::constFind()
QVERIFY(map1.constFind(4) == map1.constEnd());
- QVERIFY(map1.constFind(1).value() == "Mayer");
- QVERIFY(map1.constFind(2).value() == "Hej");
+ QCOMPARE(map1.constFind(1).value(), QLatin1String("Mayer"));
+ QCOMPARE(map1.constFind(2).value(), QLatin1String("Hej"));
for(i = 3; i < 10; ++i) {
compareString = testString.arg(i);
@@ -705,10 +705,10 @@ void tst_QMap::lowerUpperBound()
QCOMPARE(map1.lowerBound(5).key(), 5);
QCOMPARE(map1.lowerBound(6).key(), 7);
QCOMPARE(map1.lowerBound(7).key(), 7);
- QCOMPARE(map1.lowerBound(6).value(), QString("seven_2"));
- QCOMPARE(map1.lowerBound(7).value(), QString("seven_2"));
- QCOMPARE((++map1.lowerBound(6)).value(), QString("seven"));
- QCOMPARE((++map1.lowerBound(7)).value(), QString("seven"));
+ QCOMPARE(map1.lowerBound(6).value(), QLatin1String("seven_2"));
+ QCOMPARE(map1.lowerBound(7).value(), QLatin1String("seven_2"));
+ QCOMPARE((++map1.lowerBound(6)).value(), QLatin1String("seven"));
+ QCOMPARE((++map1.lowerBound(7)).value(), QLatin1String("seven"));
QCOMPARE(map1.lowerBound(10).key(), 10);
QVERIFY(map1.lowerBound(999) == map1.end());
}
@@ -733,11 +733,11 @@ void tst_QMap::mergeCompare()
map1b.unite(map2b);
sanityCheckTree(map1b, __LINE__);
- QVERIFY(map1.value(1) == "ett");
- QVERIFY(map1.value(2) == "tvo");
- QVERIFY(map1.value(3) == "tre");
- QVERIFY(map1.value(4) == "fyra");
- QVERIFY(map1.value(5) == "fem");
+ QCOMPARE(map1.value(1), QLatin1String("ett"));
+ QCOMPARE(map1.value(2), QLatin1String("tvo"));
+ QCOMPARE(map1.value(3), QLatin1String("tre"));
+ QCOMPARE(map1.value(4), QLatin1String("fyra"));
+ QCOMPARE(map1.value(5), QLatin1String("fem"));
map3.insert(1, "ett");
map3.insert(2, "tvo");
@@ -755,7 +755,7 @@ void tst_QMap::take()
map.insert(2, "zwei");
map.insert(3, "drei");
- QVERIFY(map.take(3) == "drei");
+ QCOMPARE(map.take(3), QLatin1String("drei"));
QVERIFY(!map.contains(3));
}
@@ -771,19 +771,19 @@ void tst_QMap::iterators()
//STL-Style iterators
QMap<int, QString>::iterator stlIt = map.begin();
- QVERIFY(stlIt.value() == "Teststring 1");
+ QCOMPARE(stlIt.value(), QLatin1String("Teststring 1"));
stlIt+=5;
- QVERIFY(stlIt.value() == "Teststring 6");
+ QCOMPARE(stlIt.value(), QLatin1String("Teststring 6"));
stlIt++;
- QVERIFY(stlIt.value() == "Teststring 7");
+ QCOMPARE(stlIt.value(), QLatin1String("Teststring 7"));
stlIt-=3;
- QVERIFY(stlIt.value() == "Teststring 4");
+ QCOMPARE(stlIt.value(), QLatin1String("Teststring 4"));
stlIt--;
- QVERIFY(stlIt.value() == "Teststring 3");
+ QCOMPARE(stlIt.value(), QLatin1String("Teststring 3"));
for(stlIt = map.begin(), i = 1; stlIt != map.end(); ++stlIt, ++i)
QVERIFY(stlIt.value() == testString.arg(i));
@@ -792,19 +792,19 @@ void tst_QMap::iterators()
//STL-Style const-iterators
QMap<int, QString>::const_iterator cstlIt = map.constBegin();
- QVERIFY(cstlIt.value() == "Teststring 1");
+ QCOMPARE(cstlIt.value(), QLatin1String("Teststring 1"));
cstlIt+=5;
- QVERIFY(cstlIt.value() == "Teststring 6");
+ QCOMPARE(cstlIt.value(), QLatin1String("Teststring 6"));
cstlIt++;
- QVERIFY(cstlIt.value() == "Teststring 7");
+ QCOMPARE(cstlIt.value(), QLatin1String("Teststring 7"));
cstlIt-=3;
- QVERIFY(cstlIt.value() == "Teststring 4");
+ QCOMPARE(cstlIt.value(), QLatin1String("Teststring 4"));
cstlIt--;
- QVERIFY(cstlIt.value() == "Teststring 3");
+ QCOMPARE(cstlIt.value(), QLatin1String("Teststring 3"));
for(cstlIt = map.constBegin(), i = 1; cstlIt != map.constEnd(); ++cstlIt, ++i)
QVERIFY(cstlIt.value() == testString.arg(i));