From dedc6556d47f73ecb9274a53ca3e84dc760876a2 Mon Sep 17 00:00:00 2001 From: Andrii Semkiv Date: Wed, 30 Oct 2024 16:16:47 +0100 Subject: [PATCH] Debugger: Fix dumping with _GLIBCXX_DEBUG Fixed dumping of the standard library iterator types in case the binary is compiled with _GLIBCXX_DEBUG switch. Some non-stdlib tests that also used to fail after enabling _GLIBCXX_DEBUG due to a crash in `QCborMap::fromVariantMap` were adjusted as well. Full list of affected tests: * StdMap - fix * StdSet - fix * QC41700 - indirect fix (this test uses map iterators internally) * QCbor - workaround (QCborMap::fromVariantMap is simply avoided) * QJson - workaround (same as above) All in all, enabling _GLIBCXX_DEBUG in the test should not produce more failures compared to running without it. *Note: tested locally with mingw 13.10.* Fixes: QTCREATORBUG-31876 Change-Id: Ie55a40dc9a1aadb20795ad43abd0597047c429e4 Reviewed-by: hjk --- share/qtcreator/debugger/stdtypes.py | 30 +- tests/auto/debugger/tst_dumpers.cpp | 489 +++++++++++++++------------ 2 files changed, 295 insertions(+), 224 deletions(-) diff --git a/share/qtcreator/debugger/stdtypes.py b/share/qtcreator/debugger/stdtypes.py index b825195311a..f7acc264ac2 100644 --- a/share/qtcreator/debugger/stdtypes.py +++ b/share/qtcreator/debugger/stdtypes.py @@ -448,7 +448,35 @@ def qdump__std__map__iterator(d, value): def qdump____gnu_debug___Safe_iterator(d, value): - d.putItem(value["_M_current"]) + node = value["_M_node"].dereference() + d.putExpandable() + d.putEmptyValue() + if d.isExpanded(): + with Children(d): + real_iterator_type = value.type[0] # std::_Rb_tree_iterator or std::_Rb_tree_iterator> + inner_type = real_iterator_type[0] # T or std::pair + is_map = inner_type.name.startswith('std::pair') + if is_map: + key_type = inner_type[0] + value_type = inner_type[1] + typecode = f'pppp@{{{key_type.name}}}@{{{value_type.name}}}' + (color, parent, left, right, pad1, key, pad2, value) = d.split(typecode, node) + d.putSubItem("first", key) + d.putSubItem("second", value) + else: + typecode = f'pppp@{{{inner_type.name}}}' + (color, parent, left, right, pad1, key) = d.split(typecode, node) + d.putSubItem("value", key) + with SubItem(d, "[node]"): + d.putExpandable() + d.putEmptyValue() + d.putType(" ") + if d.isExpanded(): + with Children(d): + nodeType = node.type.pointer() + d.putSubItem("left", d.createValue(left, nodeType)) + d.putSubItem("right", d.createValue(right, nodeType)) + d.putSubItem("parent", d.createValue(parent, nodeType)) def qdump__std__map__const_iterator(d, value): diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index bf110533899..45e91af5657 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -7844,243 +7844,286 @@ void tst_Dumpers::dumper_data() + Check("pol", "<5 items>", "@QPolygonF") + Check("p", "<5 items>", "@QGraphicsPolygonItem"); + // clang-format off + auto qcborData = Data{ + R"( + #include + #if QT_VERSION >= 0x050c00 + #include + #include + #include + #include + #endif + )", + R"( + #if QT_VERSION >= 0x050c00 + QCborMap ob0; + #ifndef _GLIBCXX_DEBUG // crashes in QCborMap::fromVariantMap if _GLIBCXX_DEBUG is on + QCborMap ob = QCborMap::fromVariantMap({ + {"a", 1}, + {"bb", 2}, + {"ccc", "hallo"}, + {"s", "ssss"} + }); + ob.insert(QLatin1String("d"), QCborMap::fromVariantMap({{"ddd", 1234}})); + #endif - QTest::newRow("QCbor") - << Data("#include \n" - "#if QT_VERSION >= 0x050c00\n" - "#include \n" - "#include \n" - "#include \n" - "#include \n" - "#endif\n", + QCborValue a0; + QCborValue a1(1); + QCborValue a2("asd"); + QCborValue a3(QString::fromUtf8("cöder")); + QCborValue a4(1.4); + QCborValue a5(true); + QCborValue a6(QByteArray("cder")); - "#if QT_VERSION >= 0x050c00\n" - "QCborMap ob0;\n" - "QCborMap ob = QCborMap::fromVariantMap({\n" - " {\"a\", 1},\n" - " {\"bb\", 2},\n" - " {\"ccc\", \"hallo\"},\n" - " {\"s\", \"ssss\"}\n" - "});\n" - "ob.insert(QLatin1String(\"d\"), QCborMap::fromVariantMap({{\"ddd\", 1234}}));\n" - "\n" - "QCborValue a0;\n" - "QCborValue a1(1);\n" - "QCborValue a2(\"asd\");\n" - "QCborValue a3(QString::fromUtf8(\"cöder\"));\n" - "QCborValue a4(1.4);\n" - "QCborValue a5(true);\n" - "QCborValue a6(QByteArray(\"cder\"));\n" - "\n" - "QCborArray aa;\n" - "QCborArray a;\n" - "a.append(a1);\n" - "a.append(a2);\n" - "a.append(a3);\n" - "a.append(a4);\n" - "a.append(a5);\n" - "a.append(a0);\n" - "a.append(ob);\n" - "\n" - "QCborArray b;\n" - "b.append(QCborValue(1));\n" - "b.append(a);\n" - "b.append(QCborValue(2));\n" - "\n" - "QCborArray c;\n" - "for (unsigned int i = 0; i < 32; ++i) {\n" - " c.append(QCborValue(qint64(1u << i) - 1));\n" - " c.append(QCborValue(qint64(1u << i)));\n" - " c.append(QCborValue(qint64(1u << i) + 1));\n" - "}\n" - "for (unsigned int i = 0; i < 32; ++i) {\n" - " c.append(QCborValue(-qint64(1u << i) + 1));\n" - " c.append(QCborValue(-qint64(1u << i)));\n" - " c.append(QCborValue(-qint64(1u << i) - 1));\n" - "}" - "unused(&b, &a, &aa);\n" - "#endif\n", + QCborArray aa; + QCborArray a; + a.append(a1); + a.append(a2); + a.append(a3); + a.append(a4); + a.append(a5); + a.append(a0); + #ifndef _GLIBCXX_DEBUG // see above + a.append(ob); + #endif - "") + QCborArray b; + b.append(QCborValue(1)); + b.append(a); + b.append(QCborValue(2)); - + Cxx11Profile() - + CoreProfile() - + QtVersion(0x50f00) - + MsvcVersion(1900) + QCborArray c; + for (unsigned int i = 0; i < 32; ++i) { + c.append(QCborValue(qint64(1u << i) - 1)); + c.append(QCborValue(qint64(1u << i))); + c.append(QCborValue(qint64(1u << i) + 1)); + } + for (unsigned int i = 0; i < 32; ++i) { + c.append(QCborValue(-qint64(1u << i) + 1)); + c.append(QCborValue(-qint64(1u << i))); + c.append(QCborValue(-qint64(1u << i) - 1)); + } + unused(&b, &a, &aa); + #endif + )", + "" + } - + Check("a0", "Undefined", "QCborValue (Undefined)") - + Check("a1", "1", "QCborValue (Integer)") - + Check("a2", "\"asd\"", "QCborValue (String)") - + Check("a3", "\"cöder\"", "QCborValue (String)") - + Check("a4", "1.400000", "QCborValue (Double)") - + Check("a5", "True", "QCborValue (True)") - + Check("a6", "\"cder\"", "QCborValue (ByteArray)") - + Check("aa", "<0 items>", "@QCborArray") - + Check("a", "<7 items>", "@QCborArray") - + Check("a.0", "[0]", "1", "QCborValue (Integer)") - + Check("a.1", "[1]", "\"asd\"", "QCborValue (String)") - + Check("a.2", "[2]", "\"cöder\"", "QCborValue (String)") - + Check("a.3", "[3]", "1.400000", "QCborValue (Double)") - + Check("a.4", "[4]", "True", "QCborValue (True)") - + Check("a.5", "[5]", "Undefined", "QCborValue (Undefined)") - + Check("a.6", "[6]", "<5 items>", "QCborValue (Map)") - + Check("a.6.0", "[0] \"a\"", "1", "") - + Check("a.6.1", "[1] \"bb\"", "2", "") - + Check("a.6.2", "[2] \"ccc\"", "\"hallo\"", "") - + Check("a.6.3", "[3] \"s\"", "\"ssss\"", "") - + Check("a.6.4", "[4] \"d\"", "<1 items>", "") - + Check("b", "b", "<3 items>" , "@QCborArray") - + Check("b.0", "[0]", "1", "QCborValue (Integer)") - + Check("b.1", "[1]", "<7 items>", "QCborValue (Array)") - + Check("b.1.0", "[0]", "1", "QCborValue (Integer)") - + Check("b.1.1", "[1]", "\"asd\"", "QCborValue (String)") - + Check("b.1.2", "[2]", "\"cöder\"", "QCborValue (String)") - + Check("b.1.3", "[3]", "1.400000", "QCborValue (Double)") - + Check("b.1.4", "[4]", "True", "QCborValue (True)") - + Check("b.1.5", "[5]", "Undefined", "QCborValue (Undefined)") - + Check("b.1.6", "[6]", "<5 items>", "QCborValue (Map)") - + Check("b.2", "[2]", "2", "QCborValue (Integer)") - + Check("c", "c", "<192 items>", "@QCborArray") - + Check("c.0", "[0]", "0", "QCborValue (Integer)") - + Check("c.1", "[1]", "1", "QCborValue (Integer)") - + Check("c.78", "[78]", "67108863", "QCborValue (Integer)") - + Check("c.79", "[79]", "67108864", "QCborValue (Integer)") - + Check("c.94", "[94]", "2147483648", "QCborValue (Integer)") - + Check("c.95", "[95]", "2147483649", "QCborValue (Integer)") - + Check("c.96", "[96]", "0", "QCborValue (Integer)") - + Check("c.97", "[97]", "-1", "QCborValue (Integer)") - + Check("c.174", "[174]", "-67108863", "QCborValue (Integer)") - + Check("c.175", "[175]", "-67108864", "QCborValue (Integer)") - + Check("ob0", "ob0", "<0 items>", "@QCborMap") - + Check("ob", "ob", "<5 items>", "@QCborMap") - + Check("ob.0", "[0] \"a\"", "1", "") - + Check("ob.0.key", "key", "\"a\"", "QCborValue (String)") - + Check("ob.0.value", "value", "1", "QCborValue (Integer)") - + Check("ob.1", "[1] \"bb\"", "2", "") - + Check("ob.2", "[2] \"ccc\"", "\"hallo\"", "") - + Check("ob.3", "[3] \"s\"", "\"ssss\"", "") - + Check("ob.4", "[4] \"d\"", "<1 items>", "") - ; + + Cxx11Profile() + + CoreProfile() + + QtVersion(0x50f00) + + MsvcVersion(1900) + + Check("a0", "Undefined", "QCborValue (Undefined)") + + Check("a1", "1", "QCborValue (Integer)") + + Check("a2", "\"asd\"", "QCborValue (String)") + + Check("a3", "\"cöder\"", "QCborValue (String)") + + Check("a4", "1.400000", "QCborValue (Double)") + + Check("a5", "True", "QCborValue (True)") + + Check("a6", "\"cder\"", "QCborValue (ByteArray)") + + Check("aa", "<0 items>", "@QCborArray") + + Check("a.0", "[0]", "1", "QCborValue (Integer)") + + Check("a.1", "[1]", "\"asd\"", "QCborValue (String)") + + Check("a.2", "[2]", "\"cöder\"", "QCborValue (String)") + + Check("a.3", "[3]", "1.400000", "QCborValue (Double)") + + Check("a.4", "[4]", "True", "QCborValue (True)") + + Check("a.5", "[5]", "Undefined", "QCborValue (Undefined)") + + Check("b", "b", "<3 items>" , "@QCborArray") + + Check("b.0", "[0]", "1", "QCborValue (Integer)") + + Check("b.1.0", "[0]", "1", "QCborValue (Integer)") + + Check("b.1.1", "[1]", "\"asd\"", "QCborValue (String)") + + Check("b.1.2", "[2]", "\"cöder\"", "QCborValue (String)") + + Check("b.1.3", "[3]", "1.400000", "QCborValue (Double)") + + Check("b.1.4", "[4]", "True", "QCborValue (True)") + + Check("b.1.5", "[5]", "Undefined", "QCborValue (Undefined)") + + Check("b.2", "[2]", "2", "QCborValue (Integer)") + + Check("c", "c", "<192 items>", "@QCborArray") + + Check("c.0", "[0]", "0", "QCborValue (Integer)") + + Check("c.1", "[1]", "1", "QCborValue (Integer)") + + Check("c.78", "[78]", "67108863", "QCborValue (Integer)") + + Check("c.79", "[79]", "67108864", "QCborValue (Integer)") + + Check("c.94", "[94]", "2147483648", "QCborValue (Integer)") + + Check("c.95", "[95]", "2147483649", "QCborValue (Integer)") + + Check("c.96", "[96]", "0", "QCborValue (Integer)") + + Check("c.97", "[97]", "-1", "QCborValue (Integer)") + + Check("c.174", "[174]", "-67108863", "QCborValue (Integer)") + + Check("c.175", "[175]", "-67108864", "QCborValue (Integer)") + + Check("ob0", "ob0", "<0 items>", "@QCborMap"); + + // there's a SIGSEGV in QCborMap::fromVariantMap if the test is run with _GLIBCXX_DEBUG on + if (!m_useGLibCxxDebug) + { + qcborData = qcborData + + Check("a", "<7 items>", "@QCborArray") + + Check("a.6", "[6]", "<5 items>", "QCborValue (Map)") + + Check("a.6.0", "[0] \"a\"", "1", "") + + Check("a.6.1", "[1] \"bb\"", "2", "") + + Check("a.6.2", "[2] \"ccc\"", "\"hallo\"", "") + + Check("a.6.3", "[3] \"s\"", "\"ssss\"", "") + + Check("a.6.4", "[4] \"d\"", "<1 items>", "") + + Check("b.1", "[1]", "<7 items>", "QCborValue (Array)") + + Check("b.1.6", "[6]", "<5 items>", "QCborValue (Map)") + + Check("ob", "ob", "<5 items>", "@QCborMap") + + Check("ob.0", "[0] \"a\"", "1", "") + + Check("ob.0.key", "key", "\"a\"", "QCborValue (String)") + + Check("ob.0.value", "value", "1", "QCborValue (Integer)") + + Check("ob.1", "[1] \"bb\"", "2", "") + + Check("ob.2", "[2] \"ccc\"", "\"hallo\"", "") + + Check("ob.3", "[3] \"s\"", "\"ssss\"", "") + + Check("ob.4", "[4] \"d\"", "<1 items>", ""); + } + else + { + qcborData = qcborData + + Check("a", "<6 items>", "@QCborArray") + + Check("b.1", "[1]", "<6 items>", "QCborValue (Array)"); + } + // clang-format on + QTest::newRow("QCbor") << qcborData; const QtVersion jsonv1{0, 0x50f00}; const QtVersion jsonv2{0x50f00, 0x60000}; + // clang-format off + auto qjsonData = Data{ + R"( + #include + #if QT_VERSION >= 0x050000 + #include + #include + #include + #include + #endif + )", + R"( + #if QT_VERSION >= 0x050000 + QJsonObject ob0; + #ifndef _GLIBCXX_DEBUG // crashes in QCborMap::fromVariantMap if _GLIBCXX_DEBUG is on + QJsonObject ob = QJsonObject::fromVariantMap({ + {"a", 1}, + {"bb", 2}, + {"ccc", "hallo"}, + {"s", "ssss"} + }); + ob.insert(QLatin1String("d"), QJsonObject::fromVariantMap({{"ddd", 1234}})); + #endif - QTest::newRow("QJson") - << Data("#include \n" - "#if QT_VERSION >= 0x050000\n" - "#include \n" - "#include \n" - "#include \n" - "#include \n" - "#endif\n", + QJsonArray aa; + QJsonArray a; + a.append(QJsonValue(1)); + a.append(QJsonValue("asd")); + a.append(QJsonValue(QString::fromLatin1("cdfer"))); + a.append(QJsonValue(1.4)); + a.append(QJsonValue(true)); + #ifndef _GLIBCXX_DEBUG // see above + a.append(ob); + #endif - "#if QT_VERSION >= 0x050000\n" - "QJsonObject ob0;\n" - "QJsonObject ob = QJsonObject::fromVariantMap({\n" - " {\"a\", 1},\n" - " {\"bb\", 2},\n" - " {\"ccc\", \"hallo\"},\n" - " {\"s\", \"ssss\"}\n" - "});\n" - "ob.insert(QLatin1String(\"d\"), QJsonObject::fromVariantMap({{\"ddd\", 1234}}));\n" - "\n" - "QJsonArray aa;\n" - "QJsonArray a;\n" - "a.append(QJsonValue(1));\n" - "a.append(QJsonValue(\"asd\"));\n" - "a.append(QJsonValue(QString::fromLatin1(\"cdfer\")));\n" - "a.append(QJsonValue(1.4));\n" - "a.append(QJsonValue(true));\n" - "a.append(ob);\n" - "\n" - "QJsonArray b;\n" - "b.append(QJsonValue(1));\n" - "b.append(a);\n" - "b.append(QJsonValue(2));\n" - "\n" - "QJsonArray c;\n" - "for (unsigned int i = 0; i < 32; ++i) {\n" - " c.append(QJsonValue(qint64(1u << i) - 1));\n" - " c.append(QJsonValue(qint64(1u << i)));\n" - " c.append(QJsonValue(qint64(1u << i) + 1));\n" - "}\n" - "for (unsigned int i = 0; i < 32; ++i) {\n" - " c.append(QJsonValue(-qint64(1u << i) + 1));\n" - " c.append(QJsonValue(-qint64(1u << i)));\n" - " c.append(QJsonValue(-qint64(1u << i) - 1));\n" - "}" - "unused(&ob, &b, &a, &aa);\n" - "#endif\n", + QJsonArray b; + b.append(QJsonValue(1)); + b.append(a); + b.append(QJsonValue(2)); - "") + QJsonArray c; + for (unsigned int i = 0; i < 32; ++i) { + c.append(QJsonValue(qint64(1u << i) - 1)); + c.append(QJsonValue(qint64(1u << i))); + c.append(QJsonValue(qint64(1u << i) + 1)); + } + for (unsigned int i = 0; i < 32; ++i) { + c.append(QJsonValue(-qint64(1u << i) + 1)); + c.append(QJsonValue(-qint64(1u << i))); + c.append(QJsonValue(-qint64(1u << i) - 1)); + } + unused( + #ifndef _GLIBCXX_DEBUG // see above + &ob, + #endif + &b, &a, &aa); + #endif + )", + "" + } - + Cxx11Profile() - + CoreProfile() - + QtVersion(0x50000) - + MsvcVersion(1900) + + Cxx11Profile() + + CoreProfile() + + QtVersion(0x50000) + + MsvcVersion(1900) - + Check("aa", "<0 items>", "@QJsonArray") - + Check("a", "<6 items>", "@QJsonArray") - + Check("a.0", "[0]", "1", "QJsonValue (Number)") - + Check("a.1", "[1]", "\"asd\"", "QJsonValue (String)") - + Check("a.2", "[2]", "\"cdfer\"", "QJsonValue (String)") - + Check("a.3", "[3]", "1.4", "QJsonValue (Number)") % jsonv1 - + Check("a.3", "[3]", "1.400000", "QJsonValue (Number)") % jsonv2 - + Check("a.4", "[4]", "true", "QJsonValue (Bool)") % jsonv1 - + Check("a.4", "[4]", "True", "QJsonValue (Bool)") % jsonv2 - + Check("a.5", "[5]", "<5 items>", "QJsonValue (Object)") - + Check("a.5.0", "\"a\"", "1", "QJsonValue (Number)") % jsonv1 - + Check("a.5.0", "[0] \"a\"", "1", "" ) % jsonv2 - + Check("a.5.1", "\"bb\"", "2", "QJsonValue (Number)") % jsonv1 - + Check("a.5.1", "[1] \"bb\"", "2", "" ) % jsonv2 - + Check("a.5.2", "\"ccc\"", "\"hallo\"", "QJsonValue (String)") % jsonv1 - + Check("a.5.2", "[2] \"ccc\"","\"hallo\"", "" ) % jsonv2 - + Check("a.5.3", "\"d\"", "<1 items>", "QJsonValue (Object)") % jsonv1 - + Check("a.5.3", "[3] \"d\"", "<1 items>", "" ) % jsonv2 - + Check("a.5.4", "\"s\"", "\"ssss\"", "QJsonValue (String)") % jsonv1 - + Check("a.5.4", "[4] \"s\"", "\"ssss\"", "" ) % jsonv2 - + Check("b", "b", "<3 items>" , "@QJsonArray") - + Check("b.0", "[0]", "1", "QJsonValue (Number)") - + Check("b.1", "[1]", "<6 items>", "QJsonValue (Array)") - + Check("b.1.0", "[0]", "1", "QJsonValue (Number)") % jsonv2 - + Check("b.1.1", "[1]", "\"asd\"", "QJsonValue (String)") % jsonv2 - + Check("b.1.2", "[2]", "\"cdfer\"", "QJsonValue (String)") % jsonv2 - + Check("b.1.3", "[3]", "1.4", "QJsonValue (Number)") % jsonv1 - + Check("b.1.3", "[3]", "1.400000", "QJsonValue (Number)") % jsonv2 - + Check("b.1.4", "[4]", "true", "QJsonValue (Bool)") % jsonv1 - + Check("b.1.5", "[5]", "<5 items>", "QJsonValue (Object)") % jsonv2 - + Check("b.2", "[2]", "2", "QJsonValue (Number)") % jsonv2 - + Check("c", "c", "<192 items>", "@QJsonArray") - + Check("c.0", "[0]", "0.0", "QJsonValue (Number)") % jsonv1 - + Check("c.0", "[0]", "0", "QJsonValue (Number)") % jsonv2 - + Check("c.1", "[1]", "1", "QJsonValue (Number)") - + Check("c.78", "[78]", "67108863", "QJsonValue (Number)") - + Check("c.79", "[79]", "67108864.0", "QJsonValue (Number)") % jsonv1 - + Check("c.79", "[79]", "67108864", " QJsonValue (Number)") % jsonv2 - + Check("c.94", "[94]", "2147483648.0", "QJsonValue (Number)") % jsonv1 - + Check("c.94", "[94]", "2147483648", "QJsonValue (Number)") % jsonv2 - + Check("c.95", "[95]", "2147483649.0", "QJsonValue (Number)") % jsonv1 - + Check("c.95", "[95]", "2147483649", "QJsonValue (Number)") % jsonv2 - + Check("c.96", "[96]", "0.0", "QJsonValue (Number)") % jsonv1 - + Check("c.96", "[96]", "0", "QJsonValue (Number)") % jsonv2 - + Check("c.97", "[97]", "-1", "QJsonValue (Number)") - + Check("c.174", "[174]", "-67108863", "QJsonValue (Number)") - + Check("c.175", "[175]", "-67108864.0", "QJsonValue (Number)") % jsonv1 - + Check("c.175", "[175]", "-67108864", "QJsonValue (Number)") % jsonv2 - + Check("ob0", "ob0", "<0 items>", "@QJsonObject") - + Check("ob", "ob", "<5 items>", "@QJsonObject") - + Check("ob.0", "\"a\"", "1", "QJsonValue (Number)") % jsonv1 - + Check("ob.0", "[0] \"a\"", "1", "" ) % jsonv2 - + Check("ob.1", "\"bb\"", "2", "QJsonValue (Number)") % jsonv1 - + Check("ob.1", "[1] \"bb\"", "2", "" ) % jsonv2 - + Check("ob.2", "\"ccc\"", "\"hallo\"", "QJsonValue (String)") % jsonv1 - + Check("ob.2", "[2] \"ccc\"", "\"hallo\"", "" ) % jsonv2 - + Check("ob.3", "\"d\"", "<1 items>", "QJsonValue (Object)") % jsonv1 - + Check("ob.3", "[3] \"d\"", "<1 items>", "" ) % jsonv2 - + Check("ob.4", "\"s\"", "\"ssss\"", "QJsonValue (String)") % jsonv1 - + Check("ob.4", "[4] \"s\"", "\"ssss\"", "" ) % jsonv2; + + Check("aa", "<0 items>", "@QJsonArray") + + Check("a.0", "[0]", "1", "QJsonValue (Number)") + + Check("a.1", "[1]", "\"asd\"", "QJsonValue (String)") + + Check("a.2", "[2]", "\"cdfer\"", "QJsonValue (String)") + + Check("a.3", "[3]", "1.4", "QJsonValue (Number)") % jsonv1 + + Check("a.3", "[3]", "1.400000", "QJsonValue (Number)") % jsonv2 + + Check("a.4", "[4]", "true", "QJsonValue (Bool)") % jsonv1 + + Check("a.4", "[4]", "True", "QJsonValue (Bool)") % jsonv2 + + Check("b", "b", "<3 items>" , "@QJsonArray") + + Check("b.0", "[0]", "1", "QJsonValue (Number)") + + Check("b.2", "[2]", "2", "QJsonValue (Number)") % jsonv2 + + Check("c", "c", "<192 items>", "@QJsonArray") + + Check("c.0", "[0]", "0.0", "QJsonValue (Number)") % jsonv1 + + Check("c.0", "[0]", "0", "QJsonValue (Number)") % jsonv2 + + Check("c.1", "[1]", "1", "QJsonValue (Number)") + + Check("c.78", "[78]", "67108863", "QJsonValue (Number)") + + Check("c.79", "[79]", "67108864.0", "QJsonValue (Number)") % jsonv1 + + Check("c.79", "[79]", "67108864", "QJsonValue (Number)") % jsonv2 + + Check("c.94", "[94]", "2147483648.0", "QJsonValue (Number)") % jsonv1 + + Check("c.94", "[94]", "2147483648", "QJsonValue (Number)") % jsonv2 + + Check("c.95", "[95]", "2147483649.0", "QJsonValue (Number)") % jsonv1 + + Check("c.95", "[95]", "2147483649", "QJsonValue (Number)") % jsonv2 + + Check("c.96", "[96]", "0.0", "QJsonValue (Number)") % jsonv1 + + Check("c.96", "[96]", "0", "QJsonValue (Number)") % jsonv2 + + Check("c.97", "[97]", "-1", "QJsonValue (Number)") + + Check("c.174", "[174]", "-67108863", "QJsonValue (Number)") + + Check("c.175", "[175]", "-67108864.0", "QJsonValue (Number)") % jsonv1 + + Check("c.175", "[175]", "-67108864", "QJsonValue (Number)") % jsonv2 + + Check("ob0", "ob0", "<0 items>", "@QJsonObject"); + // there's a SIGSEGV in QCborMap::fromVariantMap if the test is run with _GLIBCXX_DEBUG on + if (!m_useGLibCxxDebug) + { + qjsonData = qjsonData + + Check("ob", "ob", "<5 items>", "@QJsonObject") + + Check("ob.0", "\"a\"", "1", "QJsonValue (Number)") % jsonv1 + + Check("ob.0", "[0] \"a\"", "1", "" ) % jsonv2 + + Check("ob.1", "\"bb\"", "2", "QJsonValue (Number)") % jsonv1 + + Check("ob.1", "[1] \"bb\"", "2", "" ) % jsonv2 + + Check("ob.2", "\"ccc\"", "\"hallo\"", "QJsonValue (String)") % jsonv1 + + Check("ob.2", "[2] \"ccc\"", "\"hallo\"", "" ) % jsonv2 + + Check("ob.3", "\"d\"", "<1 items>", "QJsonValue (Object)") % jsonv1 + + Check("ob.3", "[3] \"d\"", "<1 items>", "" ) % jsonv2 + + Check("ob.4", "\"s\"", "\"ssss\"", "QJsonValue (String)") % jsonv1 + + Check("ob.4", "[4] \"s\"", "\"ssss\"", "" ) % jsonv2 + + Check("a", "<6 items>", "@QJsonArray") + + Check("a.5", "[5]", "<5 items>", "QJsonValue (Object)") + + Check("a.5.0", "\"a\"", "1", "QJsonValue (Number)") % jsonv1 + + Check("a.5.0", "[0] \"a\"", "1", "" ) % jsonv2 + + Check("a.5.1", "\"bb\"", "2", "QJsonValue (Number)") % jsonv1 + + Check("a.5.1", "[1] \"bb\"", "2", "" ) % jsonv2 + + Check("a.5.2", "\"ccc\"", "\"hallo\"", "QJsonValue (String)") % jsonv1 + + Check("a.5.2", "[2] \"ccc\"", "\"hallo\"", "" ) % jsonv2 + + Check("a.5.3", "\"d\"", "<1 items>", "QJsonValue (Object)") % jsonv1 + + Check("a.5.3", "[3] \"d\"", "<1 items>", "" ) % jsonv2 + + Check("a.5.4", "\"s\"", "\"ssss\"", "QJsonValue (String)") % jsonv1 + + Check("a.5.4", "[4] \"s\"", "\"ssss\"", "" ) % jsonv2 + + Check("b.1", "[1]", "<6 items>", "QJsonValue (Array)") + + Check("b.1.0", "[0]", "1", "QJsonValue (Number)") % jsonv2 + + Check("b.1.1", "[1]", "\"asd\"", "QJsonValue (String)") % jsonv2 + + Check("b.1.2", "[2]", "\"cdfer\"", "QJsonValue (String)") % jsonv2 + + Check("b.1.3", "[3]", "1.4", "QJsonValue (Number)") % jsonv1 + + Check("b.1.3", "[3]", "1.400000", "QJsonValue (Number)") % jsonv2 + + Check("b.1.4", "[4]", "true", "QJsonValue (Bool)") % jsonv1 + + Check("b.1.5", "[5]", "<5 items>", "QJsonValue (Object)") % jsonv2; + } + else + { + qjsonData = qjsonData + + Check("a", "<5 items>", "@QJsonArray") + + Check("b.1", "[1]", "<5 items>", "QJsonValue (Array)"); + } + // clang-format on + QTest::newRow("QJson") << qjsonData; QTest::newRow("QV4") << Data("#include \n" @@ -8640,7 +8683,7 @@ void tst_Dumpers::dumper_data() + Check{"err_enum.inner", "Bad (1)", "ErrCode"} % NoGdbEngine + Check{"err_class", "Unexpected", "tl::expected"} + Check{"err_class.inner.m_x", "10", "int"}; - //clang-format on + // clang-format on } int main(int argc, char *argv[])