diff options
Diffstat (limited to 'tests/auto/corelib/tools/qchar')
-rw-r--r-- | tests/auto/corelib/tools/qchar/tst_qchar.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp index a4350ea2fe..55c911a5fc 100644 --- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp +++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp @@ -47,6 +47,8 @@ public slots: void init(); void cleanup(); private slots: + void operators_data(); + void operators(); void toUpper(); void toLower(); void toTitle(); @@ -99,6 +101,33 @@ void tst_QChar::cleanup() #endif } +void tst_QChar::operators_data() +{ + QTest::addColumn<QChar>("lhs"); + QTest::addColumn<QChar>("rhs"); + + for (int i = 0; i < 3; ++i) { + for (int j = 0; j < 3; ++j) + QTest::newRow(qPrintable(QString().sprintf("'\\%d' (op) '\\%d'", i, j))) + << QChar(ushort(i)) << QChar(ushort(j)); + } +} + +void tst_QChar::operators() +{ + QFETCH(QChar, lhs); + QFETCH(QChar, rhs); + +#define CHECK(op) QCOMPARE((lhs op rhs), (lhs.unicode() op rhs.unicode())) + CHECK(==); + CHECK(!=); + CHECK(< ); + CHECK(> ); + CHECK(<=); + CHECK(>=); +#undef CHECK +} + void tst_QChar::toUpper() { QVERIFY(QChar('a').toUpper() == 'A'); |