QString: add a tst_QString variant with QT_NO_CAST_FROM_ASCII

Now the tst_qstring is compiled three times:
- with QT_NO_CAST_FROM_ASCII defined
- with QT_RESTRICTED_CAST_FROM_ASCII defined
- with neither of the above defined

so as to cover more code paths.

Pick-to: 6.5
Task-number: QTBUG-109228
Change-Id: I65eca0f6f6aea66fed6eeda1eb77a50a97210807
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Ahmad Samir 2023-01-24 13:42:28 +02:00
parent 37dc52d4f2
commit 7564583d36
2 changed files with 116 additions and 79 deletions

View File

@ -13,7 +13,7 @@ if(WASM)
list(APPEND tst_qstring_extra_sources tst_qstring_wasm.cpp)
endif()
foreach(test tst_qstring tst_qstring_restricted_ascii)
foreach(test tst_qstring tst_qstring_restricted_ascii tst_qstring_no_cast_from_ascii)
qt_internal_add_test(${test}
SOURCES
tst_qstring.cpp
@ -31,3 +31,9 @@ qt_internal_extend_target(tst_qstring_restricted_ascii
QT_RESTRICTED_CAST_FROM_ASCII
tst_QString=tst_QString_restricted_ascii
)
qt_internal_extend_target(tst_qstring_no_cast_from_ascii
DEFINES
QT_NO_CAST_FROM_ASCII
tst_QString=tst_QString_no_cast_from_ascii
)

View File

@ -2,9 +2,6 @@
// Copyright (C) 2020 Intel Corporation.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifdef QT_NO_CAST_FROM_ASCII
# undef QT_NO_CAST_FROM_ASCII
#endif
#ifdef QT_NO_CAST_TO_ASCII
# undef QT_NO_CAST_TO_ASCII
#endif
@ -418,17 +415,19 @@ private slots:
void prepend_qcharstar_int_data() { prepend_data(EmptyIsNoop); }
void prepend_qchar() { prepend_impl<Reversed<QChar>, QString &(QString::*)(QChar)>(); }
void prepend_qchar_data() { prepend_data(EmptyIsNoop); }
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void prepend_qbytearray() { prepend_impl<QByteArray>(); }
void prepend_qbytearray_data() { prepend_data(EmptyIsNoop); }
#endif
void prepend_char() { prepend_impl<Reversed<char>, QString &(QString::*)(QChar)>(); }
void prepend_char_data() { prepend_data({EmptyIsNoop, Latin1Encoded}); }
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
void prepend_charstar() { prepend_impl<const char *, QString &(QString::*)(const char *)>(); }
void prepend_charstar_data() { prepend_data(EmptyIsNoop); }
void prepend_bytearray_special_cases_data();
void prepend_bytearray_special_cases();
#endif // !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
#if !defined(QT_NO_CAST_FROM_ASCII)
void prepend_char() { prepend_impl<Reversed<char>, QString &(QString::*)(QChar)>(); }
void prepend_char_data() { prepend_data({EmptyIsNoop, Latin1Encoded}); }
#endif
void append_qstring() { append_impl<QString>(); }
@ -443,18 +442,25 @@ private slots:
void append_qcharstar_int_data() { append_data(EmptyIsNoop); }
void append_qchar() { append_impl<QChar, QString &(QString::*)(QChar)>(); }
void append_qchar_data() { append_data(EmptyIsNoop); }
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void append_qbytearray() { append_impl<QByteArray>(); }
void append_qbytearray_data() { append_data(); }
#endif
#if !defined(QT_NO_CAST_FROM_ASCII)
void append_char() { append_impl<char, QString &(QString::*)(QChar)>(); }
void append_char_data() { append_data({EmptyIsNoop, Latin1Encoded}); }
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#endif
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void append_charstar() { append_impl<const char *, QString &(QString::*)(const char *)>(); }
void append_charstar_data() { append_data(); }
#endif
void append_special_cases();
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void append_bytearray_special_cases_data();
void append_bytearray_special_cases();
#endif
@ -469,19 +475,21 @@ private slots:
void operator_pluseq_qutf8stringview_data() { operator_pluseq_data(); }
void operator_pluseq_qchar() { operator_pluseq_impl<QChar, QString &(QString::*)(QChar)>(); }
void operator_pluseq_qchar_data() { operator_pluseq_data(EmptyIsNoop); }
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void operator_pluseq_qbytearray() { operator_pluseq_impl<QByteArray>(); }
void operator_pluseq_qbytearray_data() { operator_pluseq_data(); }
void operator_pluseq_charstar() { operator_pluseq_impl<const char *, QString &(QString::*)(const char *)>(); }
void operator_pluseq_charstar_data() { operator_pluseq_data(); }
#endif
#endif // !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void operator_pluseq_special_cases();
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void operator_pluseq_bytearray_special_cases_data();
void operator_pluseq_bytearray_special_cases();
#endif
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void operator_eqeq_bytearray_data();
void operator_eqeq_bytearray();
#endif
@ -500,16 +508,22 @@ private slots:
void insert_qcharstar_int_data() { insert_data(EmptyIsNoop); }
void insert_qchar() { insert_impl<Reversed<QChar>, QString &(QString::*)(qsizetype, QChar)>(); }
void insert_qchar_data() { insert_data(EmptyIsNoop); }
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void insert_qbytearray() { insert_impl<QByteArray>(); }
void insert_qbytearray_data() { insert_data(EmptyIsNoop); }
#endif
#ifndef QT_NO_CAST_FROM_ASCII
void insert_char() { insert_impl<Reversed<char>, QString &(QString::*)(qsizetype, QChar)>(); }
void insert_char_data() { insert_data({EmptyIsNoop, Latin1Encoded}); }
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#endif
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void insert_charstar() { insert_impl<const char *, QString &(QString::*)(qsizetype, const char*) >(); }
void insert_charstar_data() { insert_data(EmptyIsNoop); }
#endif
void insert_special_cases();
void simplified_data();
@ -547,11 +561,13 @@ private slots:
void truncate();
void chop_data();
void chop();
void constructor();
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void constructorQByteArray_data();
void constructorQByteArray();
#endif
void STL();
void macTypes();
void wasmTypes();
@ -648,7 +664,7 @@ private slots:
#endif
void literals();
void userDefinedLiterals();
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void eightBitLiterals_data();
void eightBitLiterals();
#endif
@ -1184,13 +1200,16 @@ void tst_QString::nullness()
QVERIFY(s.isNull());
}
#if defined(__cpp_char8_t) || !defined(QT_RESTRICTED_CAST_FROM_ASCII)
#if !defined(QT_NO_CAST_FROM_ASCII)
// we don't have QString(std::nullptr_t), so this uses QString(const char8_t*) in C++20:
{
QString s = nullptr;
QVERIFY(s.isNull());
}
#endif
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#endif
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
{
const char *ptr = nullptr;
QString s = ptr;
@ -1289,7 +1308,7 @@ void tst_QString::constructor()
QVERIFY(empty.isEmpty());
}
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void tst_QString::constructorQByteArray_data()
{
QTest::addColumn<QByteArray>("src" );
@ -1348,7 +1367,7 @@ void tst_QString::constructorQByteArray()
QCOMPARE(str1, expected.left(zero));
}
}
#endif // QT_RESTRICTED_CAST_FROM_ASCII
#endif // !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void tst_QString::STL()
{
@ -1756,7 +1775,7 @@ void tst_QString::indexOf()
QCOMPARE( haystack.indexOf(needle, startpos, cs), resultpos );
QCOMPARE( haystack.indexOf(view, startpos, cs), resultpos );
if (needleIsLatin) {
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && ! defined(QT_NO_CAST_FROM_ASCII)
QCOMPARE( haystack.indexOf(needle.toLatin1(), startpos, cs), resultpos );
QCOMPARE( haystack.indexOf(needle.toLatin1().data(), startpos, cs), resultpos );
#endif
@ -1789,7 +1808,7 @@ void tst_QString::indexOf()
QCOMPARE( haystack.indexOf(needle, startpos), resultpos );
QCOMPARE( haystack.indexOf(view, startpos), resultpos );
if (needleIsLatin) {
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
QCOMPARE( haystack.indexOf(needle.toLatin1(), startpos), resultpos );
QCOMPARE( haystack.indexOf(needle.toLatin1().data(), startpos), resultpos );
#endif
@ -1798,7 +1817,7 @@ void tst_QString::indexOf()
QCOMPARE( haystack.indexOf(needle), resultpos );
QCOMPARE( haystack.indexOf(view), resultpos );
if (needleIsLatin) {
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
QCOMPARE( haystack.indexOf(needle.toLatin1()), resultpos );
QCOMPARE( haystack.indexOf(needle.toLatin1().data()), resultpos );
#endif
@ -1980,7 +1999,7 @@ void tst_QString::lastIndexOf()
QCOMPARE(haystack.lastIndexOf(needle, from, cs), expected);
QCOMPARE(haystack.lastIndexOf(view, from, cs), expected);
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
QCOMPARE(haystack.lastIndexOf(needle.toLatin1(), from, cs), expected);
QCOMPARE(haystack.lastIndexOf(needle.toLatin1().data(), from, cs), expected);
#endif
@ -2014,14 +2033,14 @@ void tst_QString::lastIndexOf()
if (cs == Qt::CaseSensitive) {
QCOMPARE(haystack.lastIndexOf(needle, from), expected);
QCOMPARE(haystack.lastIndexOf(view, from), expected);
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
QCOMPARE(haystack.lastIndexOf(needle.toLatin1(), from), expected);
QCOMPARE(haystack.lastIndexOf(needle.toLatin1().data(), from), expected);
#endif
if (from == haystack.size()) {
QCOMPARE(haystack.lastIndexOf(needle), expected);
QCOMPARE(haystack.lastIndexOf(view), expected);
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
QCOMPARE(haystack.lastIndexOf(needle.toLatin1()), expected);
QCOMPARE(haystack.lastIndexOf(needle.toLatin1().data()), expected);
#endif
@ -2138,20 +2157,20 @@ void tst_QString::count()
QCOMPARE(emptyStr.count(QRegularExpression(u"invalid regex\\"_s)), 0);
#endif
QString nonBmpString = u8"\U00010000\U00010000abc\U00010000";
QString nonBmpString = u"\U00010000\U00010000abc\U00010000"_s;
QCOMPARE(nonBmpString.count(u"\U00010000"), 3);
#if QT_CONFIG(regularexpression)
QCOMPARE(nonBmpString.count(QRegularExpression(u8"\U00010000")), 3);
QCOMPARE(nonBmpString.count(QRegularExpression(u8"\U00010000a?")), 3);
QCOMPARE(nonBmpString.count(QRegularExpression(u8"\U00010000a")), 1);
QCOMPARE(nonBmpString.count(QRegularExpression(".")), 6);
QCOMPARE(nonBmpString.count(QRegularExpression(u"\U00010000"_s)), 3);
QCOMPARE(nonBmpString.count(QRegularExpression(u"\U00010000a?"_s)), 3);
QCOMPARE(nonBmpString.count(QRegularExpression(u"\U00010000a"_s)), 1);
QCOMPARE(nonBmpString.count(QRegularExpression(u"."_s)), 6);
// can't search for unpaired surrogates
QTest::ignoreMessage(QtWarningMsg, ignoreMessagePattern);
QCOMPARE(nonBmpString.count(QRegularExpression(QChar(0xd800))), 0);
QTest::ignoreMessage(QtWarningMsg, ignoreMessagePattern);
QCOMPARE(nonBmpString.count(QRegularExpression(QChar(0xdc00))), 0);
#endif
#endif // QT_CONFIG(regularexpression)
}
void tst_QString::contains()
@ -3050,7 +3069,9 @@ void tst_QString::insert_special_cases()
QCOMPARE(a.insert(4, ""_L1), montreal);
QCOMPARE(a.insert(3, ""_L1), montreal);
QCOMPARE(a.insert(3, QLatin1String(nullptr)), montreal);
#ifndef QT_NO_CAST_FROM_ASCII
QCOMPARE(a.insert(3, static_cast<const char *>(0)), montreal);
#endif
QCOMPARE(a.insert(0, u"a"_s), "aMontreal"_L1);
}
{
@ -3301,7 +3322,7 @@ void tst_QString::append_special_cases()
}
}
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void tst_QString::append_bytearray_special_cases_data()
{
QTest::addColumn<QString>("str" );
@ -3363,7 +3384,7 @@ void tst_QString::append_bytearray_special_cases()
QTEST( str, "res" );
}
}
#endif // QT_RESTRICTED_CAST_FROM_ASCII
#endif // !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void tst_QString::operator_pluseq_special_cases()
{
@ -3379,7 +3400,7 @@ void tst_QString::operator_pluseq_data(DataOptions options)
append_data(options);
}
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void tst_QString::operator_pluseq_bytearray_special_cases_data()
{
append_bytearray_special_cases_data();
@ -3431,7 +3452,7 @@ void tst_QString::operator_eqeq_bytearray()
QVERIFY(!(expected != src.constData()));
}
}
#endif // QT_RESTRICTED_CAST_FROM_ASCII
#endif // !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void tst_QString::swap()
{
@ -3534,7 +3555,7 @@ void tst_QString::prepend_data(DataOptions options)
}
}
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void tst_QString::prepend_bytearray_special_cases_data()
{
QTest::addColumn<QString>("str" );
@ -3589,7 +3610,7 @@ void tst_QString::prepend_bytearray_special_cases()
QTEST( str, "res" );
}
}
#endif // QT_RESTRICTED_CAST_FROM_ASCII
#endif // !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void tst_QString::replace_uint_uint()
{
@ -3629,6 +3650,9 @@ void tst_QString::replace_uint_uint()
s3.replace((uint)index, (uint)len, QChar(after[0]));
QTEST(s3, "result");
#if !defined(QT_NO_CAST_FROM_ASCII)
// Testing replace(qsizetype, qsizetype, QLatin1Char) calls aren't ambiguous
// Test when the string is shared
QString s4 = string;
s4.replace((uint)index, (uint)len, QChar(after[0]).toLatin1());
@ -3638,6 +3662,7 @@ void tst_QString::replace_uint_uint()
s4.detach();
s4.replace((uint)index, (uint)len, QChar(after[0]).toLatin1());
QTEST(s4, "result");
#endif
}
}
@ -3913,13 +3938,14 @@ void tst_QString::remove_string()
s4.remove( ch );
QCOMPARE(s4, result);
// What is this one testing? it calls the same remove() overload
// as the previous two
#ifndef QT_NO_CAST_FROM_ASCII
// Testing remove(QLatin1Char) isn't ambiguous
if ( QChar(ch.toLatin1()) == ch ) {
QString s2 = string;
s2.remove( ch );
s2.remove(ch.toLatin1());
QCOMPARE(s2, result);
}
#endif
}
// Test when needsDetach() is true
@ -6522,7 +6548,7 @@ void tst_QString::operator_smaller()
QVERIFY( !(null < empty) );
QVERIFY( !(null > empty) );
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
QVERIFY( !(nullC < empty) );
QVERIFY( !(nullC > empty) );
@ -6591,25 +6617,21 @@ void tst_QString::operator_smaller()
QVERIFY( (QLatin1String("z") > foo));
// operator< is not locale-aware (or shouldn't be)
QVERIFY( foo < QString("\xc3\xa9") );
QCOMPARE_LT(foo, QString::fromUtf8("\xc3\xa9"));
#ifndef QT_NO_CAST_FROM_ASCII
QVERIFY( foo < "\xc3\xa9" );
#endif
QVERIFY(QString("a") < QString("b"));
QVERIFY(QString("a") <= QString("b"));
QVERIFY(QString("a") <= QString("a"));
QVERIFY(QString("a") == QString("a"));
QVERIFY(QString("a") >= QString("a"));
QVERIFY(QString("b") >= QString("a"));
QVERIFY(QString("b") > QString("a"));
QVERIFY("a" < QString("b"));
QVERIFY("a" <= QString("b"));
QVERIFY("a" <= QString("a"));
QVERIFY("a" == QString("a"));
QVERIFY("a" >= QString("a"));
QVERIFY("b" >= QString("a"));
QVERIFY("b" > QString("a"));
QCOMPARE_LT(QString(u"a"_s), QString(u"b"_s));
QCOMPARE_LE(QString(u"a"_s), QString(u"b"_s));
QCOMPARE_LE(QString(u"a"_s), QString(u"a"_s));
QCOMPARE_EQ(QString(u"a"_s), QString(u"a"_s));
QCOMPARE_GE(QString(u"a"_s), QString(u"a"_s));
QCOMPARE_GE(QString(u"b"_s), QString(u"a"_s));
QCOMPARE_GT(QString(u"b"_s), QString(u"a"_s));
#ifndef QT_NO_CAST_FROM_ASCII
QVERIFY(QString("a") < "b");
QVERIFY(QString("a") <= "b");
QVERIFY(QString("a") <= "a");
@ -6618,7 +6640,16 @@ void tst_QString::operator_smaller()
QVERIFY(QString("b") >= "a");
QVERIFY(QString("b") > "a");
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
QCOMPARE_LT("a", QString(u"b"_s));
QCOMPARE_LE("a", QString(u"b"_s));
QCOMPARE_LE("a", QString(u"a"_s));
QCOMPARE_EQ("a", QString(u"a"_s));
QCOMPARE_GE("a", QString(u"a"_s));
QCOMPARE_GE("b", QString(u"a"_s));
QCOMPARE_GT("b", QString(u"a"_s));
#endif
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
QVERIFY(QString("a") < QByteArray("b"));
QVERIFY(QString("a") <= QByteArray("b"));
QVERIFY(QString("a") <= QByteArray("a"));
@ -6628,23 +6659,23 @@ void tst_QString::operator_smaller()
QVERIFY(QString("b") > QByteArray("a"));
#endif
QVERIFY(QLatin1String("a") < QString("b"));
QVERIFY(QLatin1String("a") <= QString("b"));
QVERIFY(QLatin1String("a") <= QString("a"));
QVERIFY(QLatin1String("a") == QString("a"));
QVERIFY(QLatin1String("a") >= QString("a"));
QVERIFY(QLatin1String("b") >= QString("a"));
QVERIFY(QLatin1String("b") > QString("a"));
QVERIFY(QLatin1String("a") < QString(u"b"_s));
QVERIFY(QLatin1String("a") <= QString(u"b"_s));
QVERIFY(QLatin1String("a") <= QString(u"a"_s));
QVERIFY(QLatin1String("a") == QString(u"a"_s));
QVERIFY(QLatin1String("a") >= QString(u"a"_s));
QVERIFY(QLatin1String("b") >= QString(u"a"_s));
QVERIFY(QLatin1String("b") > QString(u"a"_s));
QVERIFY(QString("a") < QLatin1String("b"));
QVERIFY(QString("a") <= QLatin1String("b"));
QVERIFY(QString("a") <= QLatin1String("a"));
QVERIFY(QString("a") == QLatin1String("a"));
QVERIFY(QString("a") >= QLatin1String("a"));
QVERIFY(QString("b") >= QLatin1String("a"));
QVERIFY(QString("b") > QLatin1String("a"));
QVERIFY(QString(u"a"_s) < QLatin1String("b"));
QVERIFY(QString(u"a"_s) <= QLatin1String("b"));
QVERIFY(QString(u"a"_s) <= QLatin1String("a"));
QVERIFY(QString(u"a"_s) == QLatin1String("a"));
QVERIFY(QString(u"a"_s) >= QLatin1String("a"));
QVERIFY(QString(u"b"_s) >= QLatin1String("a"));
QVERIFY(QString(u"b"_s) > QLatin1String("a"));
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
QVERIFY("a" < QLatin1String("b"));
QVERIFY("a" <= QLatin1String("b"));
QVERIFY("a" <= QLatin1String("a"));
@ -7958,7 +7989,7 @@ void tst_QString::userDefinedLiterals()
#endif // QT_DEPRECATED_SINCE(6, 8)
}
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
#if !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void tst_QString::eightBitLiterals_data()
{
QTest::addColumn<QByteArray>("data");
@ -8063,7 +8094,7 @@ void tst_QString::eightBitLiterals()
QVERIFY(stringData >= data.constData());
}
}
#endif
#endif // !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII)
void tst_QString::reserve()
{