summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qmap
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-11-07 19:19:27 +1000
committerQt by Nokia <qt-info@nokia.com>2011-11-10 04:42:45 +0100
commit8e11f7c93a1f7df0d10e2f851283c825ca39b75b (patch)
tree6f02b39217acd9fb9c033fbe908b8ebb1859896a /tests/auto/corelib/tools/qmap
parent2cd47107155fc251747028b9b0ae6d2c9e69e06c (diff)
Cleanup corelib autotests
Remove literal tabs. Change-Id: I210a0259773cceb20d35ebc80b889e3ebb88b540 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/corelib/tools/qmap')
-rw-r--r--tests/auto/corelib/tools/qmap/tst_qmap.cpp222
1 files changed, 111 insertions, 111 deletions
diff --git a/tests/auto/corelib/tools/qmap/tst_qmap.cpp b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
index 04d6c6a14a..d63431f921 100644
--- a/tests/auto/corelib/tools/qmap/tst_qmap.cpp
+++ b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
@@ -85,24 +85,24 @@ class MyClass
{
public:
MyClass() {
- ++count;
-// qDebug("creating MyClass count=%d", count);
+ ++count;
+// qDebug("creating MyClass count=%d", count);
}
MyClass( const QString& c) {
- count++; str = c;
-// qDebug("creating MyClass '%s' count = %d", str.latin1(), count);
+ count++; str = c;
+// qDebug("creating MyClass '%s' count = %d", str.latin1(), count);
}
~MyClass() {
- count--;
-// qDebug("deleting MyClass '%s' count = %d", str.latin1(), count);
+ count--;
+// qDebug("deleting MyClass '%s' count = %d", str.latin1(), count);
}
MyClass( const MyClass& c ) {
- count++; str = c.str;
-// qDebug("creating MyClass '%s' count = %d", str.latin1(), count);
+ count++; str = c.str;
+// qDebug("creating MyClass '%s' count = %d", str.latin1(), count);
}
MyClass &operator =(const MyClass &o) {
-// qDebug("copying MyClass '%s'", o.str.latin1());
- str = o.str; return *this;
+// qDebug("copying MyClass '%s'", o.str.latin1());
+ str = o.str; return *this;
}
QString str;
@@ -121,145 +121,145 @@ void tst_QMap::init()
void tst_QMap::count()
{
{
- MyMap map;
- MyMap map2( map );
- QCOMPARE( map.count(), 0 );
- QCOMPARE( map2.count(), 0 );
- QCOMPARE( MyClass::count, int(0) );
- // detach
- map2["Hallo"] = MyClass( "Fritz" );
- QCOMPARE( map.count(), 0 );
+ MyMap map;
+ MyMap map2( map );
+ QCOMPARE( map.count(), 0 );
+ QCOMPARE( map2.count(), 0 );
+ QCOMPARE( MyClass::count, int(0) );
+ // detach
+ map2["Hallo"] = MyClass( "Fritz" );
+ QCOMPARE( map.count(), 0 );
QCOMPARE( map2.count(), 1 );
#ifndef Q_CC_SUN
- QCOMPARE( MyClass::count, 1 );
+ QCOMPARE( MyClass::count, 1 );
#endif
}
QCOMPARE( MyClass::count, int(0) );
{
- typedef QMap<QString, MyClass> Map;
- Map map;
- QCOMPARE( map.count(), 0);
- map.insert( "Torben", MyClass("Weis") );
- QCOMPARE( map.count(), 1 );
- map.insert( "Claudia", MyClass("Sorg") );
- QCOMPARE( map.count(), 2 );
- map.insert( "Lars", MyClass("Linzbach") );
- map.insert( "Matthias", MyClass("Ettrich") );
- map.insert( "Sue", MyClass("Paludo") );
- map.insert( "Eirik", MyClass("Eng") );
- map.insert( "Haavard", MyClass("Nord") );
- map.insert( "Arnt", MyClass("Gulbrandsen") );
- map.insert( "Paul", MyClass("Tvete") );
- QCOMPARE( map.count(), 9 );
- map.insert( "Paul", MyClass("Tvete 1") );
- map.insert( "Paul", MyClass("Tvete 2") );
- map.insert( "Paul", MyClass("Tvete 3") );
- map.insert( "Paul", MyClass("Tvete 4") );
- map.insert( "Paul", MyClass("Tvete 5") );
- map.insert( "Paul", MyClass("Tvete 6") );
-
- QCOMPARE( map.count(), 9 );
+ typedef QMap<QString, MyClass> Map;
+ Map map;
+ QCOMPARE( map.count(), 0);
+ map.insert( "Torben", MyClass("Weis") );
+ QCOMPARE( map.count(), 1 );
+ map.insert( "Claudia", MyClass("Sorg") );
+ QCOMPARE( map.count(), 2 );
+ map.insert( "Lars", MyClass("Linzbach") );
+ map.insert( "Matthias", MyClass("Ettrich") );
+ map.insert( "Sue", MyClass("Paludo") );
+ map.insert( "Eirik", MyClass("Eng") );
+ map.insert( "Haavard", MyClass("Nord") );
+ map.insert( "Arnt", MyClass("Gulbrandsen") );
+ map.insert( "Paul", MyClass("Tvete") );
+ QCOMPARE( map.count(), 9 );
+ map.insert( "Paul", MyClass("Tvete 1") );
+ map.insert( "Paul", MyClass("Tvete 2") );
+ map.insert( "Paul", MyClass("Tvete 3") );
+ map.insert( "Paul", MyClass("Tvete 4") );
+ map.insert( "Paul", MyClass("Tvete 5") );
+ map.insert( "Paul", MyClass("Tvete 6") );
+
+ QCOMPARE( map.count(), 9 );
#ifndef Q_CC_SUN
- QCOMPARE( MyClass::count, 9 );
+ QCOMPARE( MyClass::count, 9 );
#endif
- Map map2( map );
- QVERIFY( map2.count() == 9 );
+ Map map2( map );
+ QVERIFY( map2.count() == 9 );
#ifndef Q_CC_SUN
- QCOMPARE( MyClass::count, 9 );
+ QCOMPARE( MyClass::count, 9 );
#endif
- map2.insert( "Kay", MyClass("Roemer") );
- QVERIFY( map2.count() == 10 );
- QVERIFY( map.count() == 9 );
+ map2.insert( "Kay", MyClass("Roemer") );
+ QVERIFY( map2.count() == 10 );
+ QVERIFY( map.count() == 9 );
#ifndef Q_CC_SUN
- QCOMPARE( MyClass::count, 19 );
+ QCOMPARE( MyClass::count, 19 );
#endif
- map2 = map;
- QVERIFY( map.count() == 9 );
- QVERIFY( map2.count() == 9 );
+ map2 = map;
+ QVERIFY( map.count() == 9 );
+ QVERIFY( map2.count() == 9 );
#ifndef Q_CC_SUN
- QCOMPARE( MyClass::count, 9 );
+ QCOMPARE( MyClass::count, 9 );
#endif
- map2.insert( "Kay", MyClass("Roemer") );
- QVERIFY( map2.count() == 10 );
+ map2.insert( "Kay", MyClass("Roemer") );
+ QVERIFY( map2.count() == 10 );
#ifndef Q_CC_SUN
- QCOMPARE( MyClass::count, 19 );
+ QCOMPARE( MyClass::count, 19 );
#endif
- map2.clear();
- QVERIFY( map.count() == 9 );
- QVERIFY( map2.count() == 0 );
+ map2.clear();
+ QVERIFY( map.count() == 9 );
+ QVERIFY( map2.count() == 0 );
#ifndef Q_CC_SUN
- QCOMPARE( MyClass::count, 9 );
+ QCOMPARE( MyClass::count, 9 );
#endif
- map2 = map;
- QVERIFY( map.count() == 9 );
- QVERIFY( map2.count() == 9 );
+ map2 = map;
+ QVERIFY( map.count() == 9 );
+ QVERIFY( map2.count() == 9 );
#ifndef Q_CC_SUN
- QCOMPARE( MyClass::count, 9 );
+ QCOMPARE( MyClass::count, 9 );
#endif
- map2.clear();
- QVERIFY( map.count() == 9 );
- QVERIFY( map2.count() == 0 );
+ map2.clear();
+ QVERIFY( map.count() == 9 );
+ QVERIFY( map2.count() == 0 );
#ifndef Q_CC_SUN
- QCOMPARE( MyClass::count, 9 );
+ QCOMPARE( MyClass::count, 9 );
#endif
- map.remove( "Lars" );
- QVERIFY( map.count() == 8 );
- QVERIFY( map2.count() == 0 );
+ map.remove( "Lars" );
+ QVERIFY( map.count() == 8 );
+ QVERIFY( map2.count() == 0 );
#ifndef Q_CC_SUN
- QCOMPARE( MyClass::count, 8 );
+ QCOMPARE( MyClass::count, 8 );
#endif
- map.remove( "Mist" );
- QVERIFY( map.count() == 8 );
- QVERIFY( map2.count() == 0 );
+ map.remove( "Mist" );
+ QVERIFY( map.count() == 8 );
+ QVERIFY( map2.count() == 0 );
#ifndef Q_CC_SUN
- QCOMPARE( MyClass::count, 8 );
+ QCOMPARE( MyClass::count, 8 );
#endif
}
QVERIFY( MyClass::count == 0 );
{
- typedef QMap<QString,MyClass> Map;
- Map map;
- map["Torben"] = MyClass("Weis");
+ typedef QMap<QString,MyClass> Map;
+ Map map;
+ map["Torben"] = MyClass("Weis");
#ifndef Q_CC_SUN
- QVERIFY( MyClass::count == 1 );
+ QVERIFY( MyClass::count == 1 );
#endif
- QVERIFY( map.count() == 1 );
+ QVERIFY( map.count() == 1 );
- (void)map["Torben"].str;
- (void)map["Lars"].str;
+ (void)map["Torben"].str;
+ (void)map["Lars"].str;
#ifndef Q_CC_SUN
- QVERIFY( MyClass::count == 2 );
+ QVERIFY( MyClass::count == 2 );
#endif
- QVERIFY( map.count() == 2 );
+ QVERIFY( map.count() == 2 );
- const Map& cmap = map;
- (void)cmap["Depp"].str;
+ const Map& cmap = map;
+ (void)cmap["Depp"].str;
#ifndef Q_CC_SUN
- QVERIFY( MyClass::count == 2 );
+ QVERIFY( MyClass::count == 2 );
#endif
- QVERIFY( map.count() == 2 );
- QVERIFY( cmap.count() == 2 );
+ QVERIFY( map.count() == 2 );
+ QVERIFY( cmap.count() == 2 );
}
QCOMPARE( MyClass::count, 0 );
{
- for ( int i = 0; i < 100; ++i )
- {
- QMap<int, MyClass> map;
- for (int j = 0; j < i; ++j)
- map.insert(j, MyClass(QString::number(j)));
- }
- QCOMPARE( MyClass::count, 0 );
+ for ( int i = 0; i < 100; ++i )
+ {
+ QMap<int, MyClass> map;
+ for (int j = 0; j < i; ++j)
+ map.insert(j, MyClass(QString::number(j)));
+ }
+ QCOMPARE( MyClass::count, 0 );
}
QCOMPARE( MyClass::count, 0 );
}
@@ -267,17 +267,17 @@ void tst_QMap::count()
void tst_QMap::clear()
{
{
- MyMap map;
- map.clear();
- QVERIFY( map.isEmpty() );
- map.insert( "key", MyClass( "value" ) );
- map.clear();
- QVERIFY( map.isEmpty() );
- map.insert( "key0", MyClass( "value0" ) );
- map.insert( "key0", MyClass( "value1" ) );
- map.insert( "key1", MyClass( "value2" ) );
- map.clear();
- QVERIFY( map.isEmpty() );
+ MyMap map;
+ map.clear();
+ QVERIFY( map.isEmpty() );
+ map.insert( "key", MyClass( "value" ) );
+ map.clear();
+ QVERIFY( map.isEmpty() );
+ map.insert( "key0", MyClass( "value0" ) );
+ map.insert( "key0", MyClass( "value1" ) );
+ map.insert( "key1", MyClass( "value2" ) );
+ map.clear();
+ QVERIFY( map.isEmpty() );
}
QCOMPARE( MyClass::count, int(0) );
}
@@ -302,8 +302,8 @@ void tst_QMap::beginEnd()
// test iteration
QString result;
for ( StringMap::ConstIterator it = map.constBegin();
- it != map.constEnd(); ++it )
- result += *it;
+ it != map.constEnd(); ++it )
+ result += *it;
QCOMPARE( result, QString( "ab" ) );
// maps should still be identical