summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/serialization/json/tst_qtjson.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2022-03-25 16:35:56 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2022-04-07 22:04:04 +0100
commitd82301a9002fc8bd1b2a81ae841cf087e8781739 (patch)
tree7f84dc2337ad599dd1d68b027bc1343b3e8f2130 /tests/auto/corelib/serialization/json/tst_qtjson.cpp
parent681bef22a7aa4fe947564f9be77b99680251e789 (diff)
Don't use QSKIP() when merely eliding part of a test
Use of QSKIP() means the whole test is skipped; when all applicable parts of a test have passed and some part of the test is inapplicable, merely report that it is skipped, rather than discarding the PASS for all the parts that do work. In the process, eliminate a spurious layer of indentation; the earlier test only needed a scope to contain its declaration, a goal adequately achieved by the scope of the if constexpr block. Task-number: QTBUG-99123 Pick-to: 6.2 6.3 Change-Id: Ie4790a24ebf49a7f3035ffad42d78450e1560832 Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'tests/auto/corelib/serialization/json/tst_qtjson.cpp')
-rw-r--r--tests/auto/corelib/serialization/json/tst_qtjson.cpp48
1 files changed, 23 insertions, 25 deletions
diff --git a/tests/auto/corelib/serialization/json/tst_qtjson.cpp b/tests/auto/corelib/serialization/json/tst_qtjson.cpp
index f79393e457..a5a8ea3948 100644
--- a/tests/auto/corelib/serialization/json/tst_qtjson.cpp
+++ b/tests/auto/corelib/serialization/json/tst_qtjson.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2021 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Copyright (C) 2022 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
@@ -409,7 +409,7 @@ void tst_QtJson::testNumbers_2()
QVERIFY2(floatValues_1[index - 1] == (floatValues_1[index] * 2), QString("Value should be double adjacent value at index %1").arg(index).toLatin1());
}
} else {
- QSKIP("Skipping 'denorm' as this type lacks denormals on this system");
+ qInfo("Skipping denormal test as this system's double type lacks support");
}
}
@@ -2332,30 +2332,28 @@ void tst_QtJson::parseNumbers()
QCOMPARE(val.toDouble(), numbers[i].n);
}
}
- {
- if constexpr (std::numeric_limits<double>::has_denorm == std::denorm_present) {
- Numbers numbers [] = {
- { "1.1e-308", 1.1e-308 },
- { "-1.1e-308", -1.1e-308 }
- };
- int size = sizeof(numbers)/sizeof(Numbers);
- for (int i = 0; i < size; ++i) {
- QByteArray json = "[ ";
- json += numbers[i].str;
- json += " ]";
- QJsonDocument doc = QJsonDocument::fromJson(json);
- QVERIFY(!doc.isEmpty());
- QCOMPARE(doc.isArray(), true);
- QCOMPARE(doc.isObject(), false);
- QJsonArray array = doc.array();
- QCOMPARE(array.size(), 1);
- QJsonValue val = array.at(0);
- QCOMPARE(val.type(), QJsonValue::Double);
- QCOMPARE(val.toDouble(), numbers[i].n);
- }
- } else {
- QSKIP("Skipping 'denorm' as this type lacks denormals on this system");
+ if constexpr (std::numeric_limits<double>::has_denorm == std::denorm_present) {
+ Numbers numbers [] = {
+ { "1.1e-308", 1.1e-308 },
+ { "-1.1e-308", -1.1e-308 }
+ };
+ int size = sizeof(numbers)/sizeof(Numbers);
+ for (int i = 0; i < size; ++i) {
+ QByteArray json = "[ ";
+ json += numbers[i].str;
+ json += " ]";
+ QJsonDocument doc = QJsonDocument::fromJson(json);
+ QVERIFY(!doc.isEmpty());
+ QCOMPARE(doc.isArray(), true);
+ QCOMPARE(doc.isObject(), false);
+ QJsonArray array = doc.array();
+ QCOMPARE(array.size(), 1);
+ QJsonValue val = array.at(0);
+ QCOMPARE(val.type(), QJsonValue::Double);
+ QCOMPARE(val.toDouble(), numbers[i].n);
}
+ } else {
+ qInfo("Skipping denormal test as this system's double type lacks support");
}
}