diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp index 8fac232962..52e1850c87 100644 --- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp @@ -151,6 +151,8 @@ private slots: #if defined(Q_COMPILER_LAMBDA) void literals(); #endif + void toUpperLower_data(); + void toUpperLower(); void macTypes(); @@ -1999,6 +2001,31 @@ void tst_QByteArray::literals() } #endif +void tst_QByteArray::toUpperLower_data() +{ + QTest::addColumn<QByteArray>("input"); + QTest::addColumn<QByteArray>("upper"); + QTest::addColumn<QByteArray>("lower"); + + QTest::newRow("empty") << QByteArray() << QByteArray() << QByteArray(); + QTest::newRow("ascii") << QByteArray("Hello World, this is a STRING") + << QByteArray("HELLO WORLD, THIS IS A STRING") + << QByteArray("hello world, this is a string"); + QTest::newRow("latin1") << QByteArray("R\311sum\351") + << QByteArray("R\311SUM\311") + << QByteArray("r\351sum\351"); + QTest::newRow("nul") << QByteArray("a\0B", 3) << QByteArray("A\0B", 3) << QByteArray("a\0b", 3); +} + +void tst_QByteArray::toUpperLower() +{ + QFETCH(QByteArray, input); + QFETCH(QByteArray, upper); + QFETCH(QByteArray, lower); + QCOMPARE(input.toUpper(), upper); + QCOMPARE(input.toLower(), lower); +} + void tst_QByteArray::macTypes() { #ifndef Q_OS_MAC |