QCOMPARE: treat values as equal if qFuzzyIsNull(each)

We hope this shall avoid some flaky failures noticed in quick tests,
e.g. tst_QQuickMenu::Material::subMenuPosition(cascading,flip) was
recently seen failing with 3.88e-11 != 0. This required some revision
to test data in the testlib selftest for floats; the resulting
expected output differs in details but not in which tests pass or
fail. QEMU, naturally, made life difficult, requiring special-case
code in the test-driver.

[ChangeLog][QtTestLib][QCOMPARE] QCOMPARE() now treats its values as
equal when qFuzzyIsNull() is true for both of them.

Change-Id: Icc6ad5164b609937eddbe39cc69120f0abf0f3b4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This commit is contained in:
Edward Welbourne 2020-04-15 13:10:31 +02:00
parent 91d18c6464
commit c78a960198
11 changed files with 278 additions and 256 deletions

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Copyright (C) 2020 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
@ -2525,16 +2525,21 @@ bool QTest::compare_helper(bool success, const char *failureMsg,
}
template <typename T>
static bool floatingCompare(const T &t1, const T &t2)
static bool floatingCompare(const T &actual, const T &expected)
{
switch (qFpClassify(t1))
switch (qFpClassify(expected))
{
case FP_INFINITE:
return (t1 < 0) == (t2 < 0) && qFpClassify(t2) == FP_INFINITE;
return (expected < 0) == (actual < 0) && qFpClassify(actual) == FP_INFINITE;
case FP_NAN:
return qFpClassify(t2) == FP_NAN;
return qFpClassify(actual) == FP_NAN;
default:
return qFuzzyCompare(t1, t2);
if (!qFuzzyIsNull(expected))
return qFuzzyCompare(actual, expected);
Q_FALLTHROUGH();
case FP_SUBNORMAL: // subnormal is always fuzzily null
case FP_ZERO:
return qFuzzyIsNull(actual);
}
}

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@ -109,19 +109,18 @@
continues. If not, a failure is recorded in the test log and the test
function returns without attempting any later checks.
Always respect QCOMPARE() parameter semantics. The first parameter passed to it
should always be the actual value produced by the code-under-test, while the
second parameter should always be the expected value. When the values don't
match, QCOMPARE() prints them with the labels \e Actual and \e Expected.
If the parameter order is swapped, debugging a failing test can be confusing.
Always respect QCOMPARE() parameter semantics. The first parameter passed to
it should always be the actual value produced by the code-under-test, while
the second parameter should always be the expected value. When the values
don't match, QCOMPARE() prints them with the labels \e Actual and \e
Expected. If the parameter order is swapped, debugging a failing test can be
confusing and tests expecting zero may fail due to rounding errors.
When comparing floating-point types (\c float, \c double, and \c qfloat16),
\l qFuzzyCompare() is used for finite values. Infinities match if they have
\l qFuzzyCompare() is used for finite values. If qFuzzyIsNull() is true for
both values, they are also considered equal. Infinities match if they have
the same sign, and any NaN as actual value matches with any NaN as expected
value (even though NaN != NaN, even when they're identical). This means that
expecting 0 can fail when the actual value may be affected by rounding errors.
One solution to this is to offset both actual and expected values by adding
some suitable constant (such as 1).
value (even though NaN != NaN, even when they're identical).
QCOMPARE() tries to output the contents of the values if the comparison fails,
so it is visible from the test log why the comparison failed.

View File

@ -17,8 +17,8 @@
Actual (operandLeft) : 999999999999
Expected (operandRight): 999999999998" result="fail"/>
<failure tag="should FAIL 4" message="Compared doubles are not the same (fuzzy compare)
Actual (operandLeft) : 9.99999999999e&#x002D;311
Expected (operandRight): 9.99999999997e&#x002D;311" result="fail"/>
Actual (operandLeft) : 1e&#x002D;12
Expected (operandRight): 9.99999999999e&#x002D;13" result="fail"/>
<failure tag="should FAIL 5" message="Compared doubles are not the same (fuzzy compare)
Actual (operandLeft) : 9.99999999999e+306
Expected (operandRight): 9.99999999997e+306" result="fail"/>
@ -106,14 +106,14 @@
Actual (operandLeft) : 1
Expected (operandRight): 3" result="fail"/>
<failure tag="should FAIL 2" message="Compared floats are not the same (fuzzy compare)
Actual (operandLeft) : 1e&#x002D;07
Expected (operandRight): 3e&#x002D;07" result="fail"/>
Actual (operandLeft) : 1e&#x002D;05
Expected (operandRight): 3e&#x002D;05" result="fail"/>
<failure tag="should FAIL 3" message="Compared floats are not the same (fuzzy compare)
Actual (operandLeft) : 99999
Expected (operandRight): 99998" result="fail"/>
<failure tag="should FAIL 4" message="Compared floats are not the same (fuzzy compare)
Actual (operandLeft) : 9.9999e&#x002D;40
Expected (operandRight): 9.99971e&#x002D;40" result="fail"/>
Actual (operandLeft) : 1.00001e&#x002D;05
Expected (operandRight): 9.9999e&#x002D;06" result="fail"/>
<failure tag="should FAIL 5" message="Compared floats are not the same (fuzzy compare)
Actual (operandLeft) : 9.9999e+37
Expected (operandRight): 9.9997e+37" result="fail"/>
@ -201,14 +201,14 @@
Actual (operandLeft) : 1
Expected (operandRight): 3" result="fail"/>
<failure tag="should FAIL 2" message="Compared qfloat16s are not the same (fuzzy compare)
Actual (operandLeft) : 0.0001
Expected (operandRight): 0.0003" result="fail"/>
Actual (operandLeft) : 0.000999
Expected (operandRight): 0.003" result="fail"/>
<failure tag="should FAIL 3" message="Compared qfloat16s are not the same (fuzzy compare)
Actual (operandLeft) : 98
Expected (operandRight): 99" result="fail"/>
<failure tag="should FAIL 4" message="Compared qfloat16s are not the same (fuzzy compare)
Actual (operandLeft) : 5.93e&#x002D;05
Expected (operandRight): 5.87e&#x002D;05" result="fail"/>
Actual (operandLeft) : 0.00101
Expected (operandRight): 0.00099" result="fail"/>
<failure tag="should FAIL 5" message="Compared qfloat16s are not the same (fuzzy compare)
Actual (operandLeft) : 5.94e+04
Expected (operandRight): 5.88e+04" result="fail"/>
@ -295,9 +295,9 @@
<failure tag="1e0" message="Compared floats are not the same (fuzzy compare)
Actual (t1): 1
Expected (t3): 3" result="fail"/>
<failure tag="1e&#x002D;7" message="Compared floats are not the same (fuzzy compare)
Actual (t1): 1e&#x002D;07
Expected (t3): 3e&#x002D;07" result="fail"/>
<failure tag="1e&#x002D;5" message="Compared floats are not the same (fuzzy compare)
Actual (t1): 1e&#x002D;05
Expected (t3): 3e&#x002D;05" result="fail"/>
<failure tag="1e+7" message="Compared floats are not the same (fuzzy compare)
Actual (t1): 1e+07
Expected (t3): 3e+07" result="fail"/>

View File

@ -38,8 +38,8 @@
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0">
<DataTag><![CDATA[should FAIL 4]]></DataTag>
<Description><![CDATA[Compared doubles are not the same (fuzzy compare)
Actual (operandLeft) : 9.99999999999e-311
Expected (operandRight): 9.99999999997e-311]]></Description>
Actual (operandLeft) : 1e-12
Expected (operandRight): 9.99999999999e-13]]></Description>
</Incident>
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[should PASS 4]]></DataTag>
@ -230,8 +230,8 @@
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0">
<DataTag><![CDATA[should FAIL 2]]></DataTag>
<Description><![CDATA[Compared floats are not the same (fuzzy compare)
Actual (operandLeft) : 1e-07
Expected (operandRight): 3e-07]]></Description>
Actual (operandLeft) : 1e-05
Expected (operandRight): 3e-05]]></Description>
</Incident>
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[should PASS 2]]></DataTag>
@ -248,8 +248,8 @@
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0">
<DataTag><![CDATA[should FAIL 4]]></DataTag>
<Description><![CDATA[Compared floats are not the same (fuzzy compare)
Actual (operandLeft) : 9.9999e-40
Expected (operandRight): 9.99971e-40]]></Description>
Actual (operandLeft) : 1.00001e-05
Expected (operandRight): 9.9999e-06]]></Description>
</Incident>
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[should PASS 4]]></DataTag>
@ -440,8 +440,8 @@
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0">
<DataTag><![CDATA[should FAIL 2]]></DataTag>
<Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare)
Actual (operandLeft) : 0.0001
Expected (operandRight): 0.0003]]></Description>
Actual (operandLeft) : 0.000999
Expected (operandRight): 0.003]]></Description>
</Incident>
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[should PASS 2]]></DataTag>
@ -458,8 +458,8 @@
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0">
<DataTag><![CDATA[should FAIL 4]]></DataTag>
<Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare)
Actual (operandLeft) : 5.93e-05
Expected (operandRight): 5.87e-05]]></Description>
Actual (operandLeft) : 0.00101
Expected (operandRight): 0.00099]]></Description>
</Incident>
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[should PASS 4]]></DataTag>
@ -645,10 +645,10 @@
Expected (t3): 3]]></Description>
</Incident>
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0">
<DataTag><![CDATA[1e-7]]></DataTag>
<DataTag><![CDATA[1e-5]]></DataTag>
<Description><![CDATA[Compared floats are not the same (fuzzy compare)
Actual (t1): 1e-07
Expected (t3): 3e-07]]></Description>
Actual (t1): 1e-05
Expected (t3): 3e-05]]></Description>
</Incident>
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0">
<DataTag><![CDATA[1e+7]]></DataTag>

View File

@ -44,10 +44,10 @@ not ok 8 - doubleComparisons(should FAIL 4)
---
type: QCOMPARE
message: Compared doubles are not the same (fuzzy compare)
wanted: 9.99999999997e-311 (operandRight)
found: 9.99999999999e-311 (operandLeft)
expected: 9.99999999997e-311 (operandRight)
actual: 9.99999999999e-311 (operandLeft)
wanted: 9.99999999999e-13 (operandRight)
found: 1e-12 (operandLeft)
expected: 9.99999999999e-13 (operandRight)
actual: 1e-12 (operandLeft)
at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 103
@ -388,22 +388,22 @@ not ok 40 - floatComparisons(should FAIL 1)
found: 1 (operandLeft)
expected: 3 (operandRight)
actual: 1 (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
ok 41 - floatComparisons(should PASS 1)
not ok 42 - floatComparisons(should FAIL 2)
---
type: QCOMPARE
message: Compared floats are not the same (fuzzy compare)
wanted: 3e-07 (operandRight)
found: 1e-07 (operandLeft)
expected: 3e-07 (operandRight)
actual: 1e-07 (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
wanted: 3e-05 (operandRight)
found: 1e-05 (operandLeft)
expected: 3e-05 (operandRight)
actual: 1e-05 (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
ok 43 - floatComparisons(should PASS 2)
not ok 44 - floatComparisons(should FAIL 3)
@ -414,22 +414,22 @@ not ok 44 - floatComparisons(should FAIL 3)
found: 99999 (operandLeft)
expected: 99998 (operandRight)
actual: 99999 (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
ok 45 - floatComparisons(should PASS 3)
not ok 46 - floatComparisons(should FAIL 4)
---
type: QCOMPARE
message: Compared floats are not the same (fuzzy compare)
wanted: 9.99971e-40 (operandRight)
found: 9.9999e-40 (operandLeft)
expected: 9.99971e-40 (operandRight)
actual: 9.9999e-40 (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
wanted: 9.9999e-06 (operandRight)
found: 1.00001e-05 (operandLeft)
expected: 9.9999e-06 (operandRight)
actual: 1.00001e-05 (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
ok 47 - floatComparisons(should PASS 4)
not ok 48 - floatComparisons(should FAIL 5)
@ -440,9 +440,9 @@ not ok 48 - floatComparisons(should FAIL 5)
found: 9.9999e+37 (operandLeft)
expected: 9.9997e+37 (operandRight)
actual: 9.9999e+37 (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
ok 49 - floatComparisons(should PASS: NaN == NaN)
not ok 50 - floatComparisons(should FAIL: NaN != 0)
@ -453,9 +453,9 @@ not ok 50 - floatComparisons(should FAIL: NaN != 0)
found: nan (operandLeft)
expected: 0 (operandRight)
actual: nan (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 51 - floatComparisons(should FAIL: 0 != NaN)
---
@ -465,9 +465,9 @@ not ok 51 - floatComparisons(should FAIL: 0 != NaN)
found: 0 (operandLeft)
expected: nan (operandRight)
actual: 0 (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 52 - floatComparisons(should FAIL: NaN != 1)
---
@ -477,9 +477,9 @@ not ok 52 - floatComparisons(should FAIL: NaN != 1)
found: nan (operandLeft)
expected: 1 (operandRight)
actual: nan (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 53 - floatComparisons(should FAIL: 1 != NaN)
---
@ -489,9 +489,9 @@ not ok 53 - floatComparisons(should FAIL: 1 != NaN)
found: 1 (operandLeft)
expected: nan (operandRight)
actual: 1 (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
ok 54 - floatComparisons(should PASS: inf == inf)
ok 55 - floatComparisons(should PASS: -inf == -inf)
@ -503,9 +503,9 @@ not ok 56 - floatComparisons(should FAIL: inf != -inf)
found: inf (operandLeft)
expected: -inf (operandRight)
actual: inf (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 57 - floatComparisons(should FAIL: -inf != inf)
---
@ -515,9 +515,9 @@ not ok 57 - floatComparisons(should FAIL: -inf != inf)
found: -inf (operandLeft)
expected: inf (operandRight)
actual: -inf (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 58 - floatComparisons(should FAIL: inf != nan)
---
@ -527,9 +527,9 @@ not ok 58 - floatComparisons(should FAIL: inf != nan)
found: inf (operandLeft)
expected: nan (operandRight)
actual: inf (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 59 - floatComparisons(should FAIL: nan != inf)
---
@ -539,9 +539,9 @@ not ok 59 - floatComparisons(should FAIL: nan != inf)
found: nan (operandLeft)
expected: inf (operandRight)
actual: nan (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 60 - floatComparisons(should FAIL: -inf != nan)
---
@ -551,9 +551,9 @@ not ok 60 - floatComparisons(should FAIL: -inf != nan)
found: -inf (operandLeft)
expected: nan (operandRight)
actual: -inf (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 61 - floatComparisons(should FAIL: nan != -inf)
---
@ -563,9 +563,9 @@ not ok 61 - floatComparisons(should FAIL: nan != -inf)
found: nan (operandLeft)
expected: -inf (operandRight)
actual: nan (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 62 - floatComparisons(should FAIL: inf != 0)
---
@ -575,9 +575,9 @@ not ok 62 - floatComparisons(should FAIL: inf != 0)
found: inf (operandLeft)
expected: 0 (operandRight)
actual: inf (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 63 - floatComparisons(should FAIL: 0 != inf)
---
@ -587,9 +587,9 @@ not ok 63 - floatComparisons(should FAIL: 0 != inf)
found: 0 (operandLeft)
expected: inf (operandRight)
actual: 0 (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 64 - floatComparisons(should FAIL: -inf != 0)
---
@ -599,9 +599,9 @@ not ok 64 - floatComparisons(should FAIL: -inf != 0)
found: -inf (operandLeft)
expected: 0 (operandRight)
actual: -inf (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 65 - floatComparisons(should FAIL: 0 != -inf)
---
@ -611,9 +611,9 @@ not ok 65 - floatComparisons(should FAIL: 0 != -inf)
found: 0 (operandLeft)
expected: -inf (operandRight)
actual: 0 (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 66 - floatComparisons(should FAIL: inf != 1)
---
@ -623,9 +623,9 @@ not ok 66 - floatComparisons(should FAIL: inf != 1)
found: inf (operandLeft)
expected: 1 (operandRight)
actual: inf (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 67 - floatComparisons(should FAIL: 1 != inf)
---
@ -635,9 +635,9 @@ not ok 67 - floatComparisons(should FAIL: 1 != inf)
found: 1 (operandLeft)
expected: inf (operandRight)
actual: 1 (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 68 - floatComparisons(should FAIL: -inf != 1)
---
@ -647,9 +647,9 @@ not ok 68 - floatComparisons(should FAIL: -inf != 1)
found: -inf (operandLeft)
expected: 1 (operandRight)
actual: -inf (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 69 - floatComparisons(should FAIL: 1 != -inf)
---
@ -659,9 +659,9 @@ not ok 69 - floatComparisons(should FAIL: 1 != -inf)
found: 1 (operandLeft)
expected: -inf (operandRight)
actual: 1 (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 70 - floatComparisons(should FAIL: inf != max)
---
@ -671,9 +671,9 @@ not ok 70 - floatComparisons(should FAIL: inf != max)
found: inf (operandLeft)
expected: 3.40282e+38 (operandRight)
actual: inf (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 71 - floatComparisons(should FAIL: inf != -max)
---
@ -683,9 +683,9 @@ not ok 71 - floatComparisons(should FAIL: inf != -max)
found: inf (operandLeft)
expected: -3.40282e+38 (operandRight)
actual: inf (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 72 - floatComparisons(should FAIL: max != inf)
---
@ -695,9 +695,9 @@ not ok 72 - floatComparisons(should FAIL: max != inf)
found: 3.40282e+38 (operandLeft)
expected: inf (operandRight)
actual: 3.40282e+38 (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 73 - floatComparisons(should FAIL: -max != inf)
---
@ -707,9 +707,9 @@ not ok 73 - floatComparisons(should FAIL: -max != inf)
found: -3.40282e+38 (operandLeft)
expected: inf (operandRight)
actual: -3.40282e+38 (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 74 - floatComparisons(should FAIL: -inf != max)
---
@ -719,9 +719,9 @@ not ok 74 - floatComparisons(should FAIL: -inf != max)
found: -inf (operandLeft)
expected: 3.40282e+38 (operandRight)
actual: -inf (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 75 - floatComparisons(should FAIL: -inf != -max)
---
@ -731,9 +731,9 @@ not ok 75 - floatComparisons(should FAIL: -inf != -max)
found: -inf (operandLeft)
expected: -3.40282e+38 (operandRight)
actual: -inf (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 76 - floatComparisons(should FAIL: max != -inf)
---
@ -743,9 +743,9 @@ not ok 76 - floatComparisons(should FAIL: max != -inf)
found: 3.40282e+38 (operandLeft)
expected: -inf (operandRight)
actual: 3.40282e+38 (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 77 - floatComparisons(should FAIL: -max != -inf)
---
@ -755,9 +755,9 @@ not ok 77 - floatComparisons(should FAIL: -max != -inf)
found: -3.40282e+38 (operandLeft)
expected: -inf (operandRight)
actual: -3.40282e+38 (operandLeft)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137)
at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:139)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 137
line: 139
...
not ok 78 - float16Comparisons(should FAIL 1)
---
@ -767,22 +767,22 @@ not ok 78 - float16Comparisons(should FAIL 1)
found: 1 (operandLeft)
expected: 3 (operandRight)
actual: 1 (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
ok 79 - float16Comparisons(should PASS 1)
not ok 80 - float16Comparisons(should FAIL 2)
---
type: QCOMPARE
message: Compared qfloat16s are not the same (fuzzy compare)
wanted: 0.0003 (operandRight)
found: 0.0001 (operandLeft)
expected: 0.0003 (operandRight)
actual: 0.0001 (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
wanted: 0.003 (operandRight)
found: 0.000999 (operandLeft)
expected: 0.003 (operandRight)
actual: 0.000999 (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
ok 81 - float16Comparisons(should PASS 2)
not ok 82 - float16Comparisons(should FAIL 3)
@ -793,22 +793,22 @@ not ok 82 - float16Comparisons(should FAIL 3)
found: 98 (operandLeft)
expected: 99 (operandRight)
actual: 98 (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
ok 83 - float16Comparisons(should PASS 3)
not ok 84 - float16Comparisons(should FAIL 4)
---
type: QCOMPARE
message: Compared qfloat16s are not the same (fuzzy compare)
wanted: 5.87e-05 (operandRight)
found: 5.93e-05 (operandLeft)
expected: 5.87e-05 (operandRight)
actual: 5.93e-05 (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
wanted: 0.00099 (operandRight)
found: 0.00101 (operandLeft)
expected: 0.00099 (operandRight)
actual: 0.00101 (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
ok 85 - float16Comparisons(should PASS 4)
not ok 86 - float16Comparisons(should FAIL 5)
@ -819,9 +819,9 @@ not ok 86 - float16Comparisons(should FAIL 5)
found: 5.94e+04 (operandLeft)
expected: 5.88e+04 (operandRight)
actual: 5.94e+04 (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
ok 87 - float16Comparisons(should PASS: NaN == NaN)
not ok 88 - float16Comparisons(should FAIL: NaN != 0)
@ -832,9 +832,9 @@ not ok 88 - float16Comparisons(should FAIL: NaN != 0)
found: nan (operandLeft)
expected: 0 (operandRight)
actual: nan (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 89 - float16Comparisons(should FAIL: 0 != NaN)
---
@ -844,9 +844,9 @@ not ok 89 - float16Comparisons(should FAIL: 0 != NaN)
found: 0 (operandLeft)
expected: nan (operandRight)
actual: 0 (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 90 - float16Comparisons(should FAIL: NaN != 1)
---
@ -856,9 +856,9 @@ not ok 90 - float16Comparisons(should FAIL: NaN != 1)
found: nan (operandLeft)
expected: 1 (operandRight)
actual: nan (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 91 - float16Comparisons(should FAIL: 1 != NaN)
---
@ -868,9 +868,9 @@ not ok 91 - float16Comparisons(should FAIL: 1 != NaN)
found: 1 (operandLeft)
expected: nan (operandRight)
actual: 1 (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
ok 92 - float16Comparisons(should PASS: inf == inf)
ok 93 - float16Comparisons(should PASS: -inf == -inf)
@ -882,9 +882,9 @@ not ok 94 - float16Comparisons(should FAIL: inf != -inf)
found: inf (operandLeft)
expected: -inf (operandRight)
actual: inf (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 95 - float16Comparisons(should FAIL: -inf != inf)
---
@ -894,9 +894,9 @@ not ok 95 - float16Comparisons(should FAIL: -inf != inf)
found: -inf (operandLeft)
expected: inf (operandRight)
actual: -inf (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 96 - float16Comparisons(should FAIL: inf != nan)
---
@ -906,9 +906,9 @@ not ok 96 - float16Comparisons(should FAIL: inf != nan)
found: inf (operandLeft)
expected: nan (operandRight)
actual: inf (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 97 - float16Comparisons(should FAIL: nan != inf)
---
@ -918,9 +918,9 @@ not ok 97 - float16Comparisons(should FAIL: nan != inf)
found: nan (operandLeft)
expected: inf (operandRight)
actual: nan (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 98 - float16Comparisons(should FAIL: -inf != nan)
---
@ -930,9 +930,9 @@ not ok 98 - float16Comparisons(should FAIL: -inf != nan)
found: -inf (operandLeft)
expected: nan (operandRight)
actual: -inf (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 99 - float16Comparisons(should FAIL: nan != -inf)
---
@ -942,9 +942,9 @@ not ok 99 - float16Comparisons(should FAIL: nan != -inf)
found: nan (operandLeft)
expected: -inf (operandRight)
actual: nan (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 100 - float16Comparisons(should FAIL: inf != 0)
---
@ -954,9 +954,9 @@ not ok 100 - float16Comparisons(should FAIL: inf != 0)
found: inf (operandLeft)
expected: 0 (operandRight)
actual: inf (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 101 - float16Comparisons(should FAIL: 0 != inf)
---
@ -966,9 +966,9 @@ not ok 101 - float16Comparisons(should FAIL: 0 != inf)
found: 0 (operandLeft)
expected: inf (operandRight)
actual: 0 (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 102 - float16Comparisons(should FAIL: -inf != 0)
---
@ -978,9 +978,9 @@ not ok 102 - float16Comparisons(should FAIL: -inf != 0)
found: -inf (operandLeft)
expected: 0 (operandRight)
actual: -inf (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 103 - float16Comparisons(should FAIL: 0 != -inf)
---
@ -990,9 +990,9 @@ not ok 103 - float16Comparisons(should FAIL: 0 != -inf)
found: 0 (operandLeft)
expected: -inf (operandRight)
actual: 0 (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 104 - float16Comparisons(should FAIL: inf != 1)
---
@ -1002,9 +1002,9 @@ not ok 104 - float16Comparisons(should FAIL: inf != 1)
found: inf (operandLeft)
expected: 1 (operandRight)
actual: inf (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 105 - float16Comparisons(should FAIL: 1 != inf)
---
@ -1014,9 +1014,9 @@ not ok 105 - float16Comparisons(should FAIL: 1 != inf)
found: 1 (operandLeft)
expected: inf (operandRight)
actual: 1 (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 106 - float16Comparisons(should FAIL: -inf != 1)
---
@ -1026,9 +1026,9 @@ not ok 106 - float16Comparisons(should FAIL: -inf != 1)
found: -inf (operandLeft)
expected: 1 (operandRight)
actual: -inf (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 107 - float16Comparisons(should FAIL: 1 != -inf)
---
@ -1038,9 +1038,9 @@ not ok 107 - float16Comparisons(should FAIL: 1 != -inf)
found: 1 (operandLeft)
expected: -inf (operandRight)
actual: 1 (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 108 - float16Comparisons(should FAIL: inf != max)
---
@ -1050,9 +1050,9 @@ not ok 108 - float16Comparisons(should FAIL: inf != max)
found: inf (operandLeft)
expected: 6.55e+04 (operandRight)
actual: inf (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 109 - float16Comparisons(should FAIL: inf != -max)
---
@ -1062,9 +1062,9 @@ not ok 109 - float16Comparisons(should FAIL: inf != -max)
found: inf (operandLeft)
expected: -6.55e+04 (operandRight)
actual: inf (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 110 - float16Comparisons(should FAIL: max != inf)
---
@ -1074,9 +1074,9 @@ not ok 110 - float16Comparisons(should FAIL: max != inf)
found: 6.55e+04 (operandLeft)
expected: inf (operandRight)
actual: 6.55e+04 (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 111 - float16Comparisons(should FAIL: -max != inf)
---
@ -1086,9 +1086,9 @@ not ok 111 - float16Comparisons(should FAIL: -max != inf)
found: -6.55e+04 (operandLeft)
expected: inf (operandRight)
actual: -6.55e+04 (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 112 - float16Comparisons(should FAIL: -inf != max)
---
@ -1098,9 +1098,9 @@ not ok 112 - float16Comparisons(should FAIL: -inf != max)
found: -inf (operandLeft)
expected: 6.55e+04 (operandRight)
actual: -inf (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 113 - float16Comparisons(should FAIL: -inf != -max)
---
@ -1110,9 +1110,9 @@ not ok 113 - float16Comparisons(should FAIL: -inf != -max)
found: -inf (operandLeft)
expected: -6.55e+04 (operandRight)
actual: -inf (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 114 - float16Comparisons(should FAIL: max != -inf)
---
@ -1122,9 +1122,9 @@ not ok 114 - float16Comparisons(should FAIL: max != -inf)
found: 6.55e+04 (operandLeft)
expected: -inf (operandRight)
actual: 6.55e+04 (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 115 - float16Comparisons(should FAIL: -max != -inf)
---
@ -1134,9 +1134,9 @@ not ok 115 - float16Comparisons(should FAIL: -max != -inf)
found: -6.55e+04 (operandLeft)
expected: -inf (operandRight)
actual: -6.55e+04 (operandLeft)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171)
at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:174)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 171
line: 174
...
not ok 116 - compareFloatTests(1e0)
---
@ -1146,21 +1146,21 @@ not ok 116 - compareFloatTests(1e0)
found: 1 (t1)
expected: 3 (t3)
actual: 1 (t1)
at: tst_float::compareFloatTests() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:210)
at: tst_float::compareFloatTests() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:215)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 210
line: 215
...
not ok 117 - compareFloatTests(1e-7)
not ok 117 - compareFloatTests(1e-5)
---
type: QCOMPARE
message: Compared floats are not the same (fuzzy compare)
wanted: 3e-07 (t3)
found: 1e-07 (t1)
expected: 3e-07 (t3)
actual: 1e-07 (t1)
at: tst_float::compareFloatTests() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:210)
wanted: 3e-05 (t3)
found: 1e-05 (t1)
expected: 3e-05 (t3)
actual: 1e-05 (t1)
at: tst_float::compareFloatTests() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:215)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 210
line: 215
...
not ok 118 - compareFloatTests(1e+7)
---
@ -1170,9 +1170,9 @@ not ok 118 - compareFloatTests(1e+7)
found: 1e+07 (t1)
expected: 3e+07 (t3)
actual: 1e+07 (t1)
at: tst_float::compareFloatTests() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:210)
at: tst_float::compareFloatTests() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:215)
file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp
line: 210
line: 215
...
ok 119 - cleanupTestCase()
1..119

View File

@ -17,7 +17,7 @@
##teamcity[testStarted name='doubleComparisons(should PASS 3)' flowId='tst_float']
##teamcity[testFinished name='doubleComparisons(should PASS 3)' flowId='tst_float']
##teamcity[testStarted name='doubleComparisons(should FAIL 4)' flowId='tst_float']
##teamcity[testFailed name='doubleComparisons(should FAIL 4)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared doubles are not the same (fuzzy compare)|n Actual (operandLeft) : 9.99999999999e-311|n Expected (operandRight): 9.99999999997e-311' flowId='tst_float']
##teamcity[testFailed name='doubleComparisons(should FAIL 4)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared doubles are not the same (fuzzy compare)|n Actual (operandLeft) : 1e-12|n Expected (operandRight): 9.99999999999e-13' flowId='tst_float']
##teamcity[testFinished name='doubleComparisons(should FAIL 4)' flowId='tst_float']
##teamcity[testStarted name='doubleComparisons(should PASS 4)' flowId='tst_float']
##teamcity[testFinished name='doubleComparisons(should PASS 4)' flowId='tst_float']
@ -114,7 +114,7 @@
##teamcity[testStarted name='floatComparisons(should PASS 1)' flowId='tst_float']
##teamcity[testFinished name='floatComparisons(should PASS 1)' flowId='tst_float']
##teamcity[testStarted name='floatComparisons(should FAIL 2)' flowId='tst_float']
##teamcity[testFailed name='floatComparisons(should FAIL 2)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared floats are not the same (fuzzy compare)|n Actual (operandLeft) : 1e-07|n Expected (operandRight): 3e-07' flowId='tst_float']
##teamcity[testFailed name='floatComparisons(should FAIL 2)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared floats are not the same (fuzzy compare)|n Actual (operandLeft) : 1e-05|n Expected (operandRight): 3e-05' flowId='tst_float']
##teamcity[testFinished name='floatComparisons(should FAIL 2)' flowId='tst_float']
##teamcity[testStarted name='floatComparisons(should PASS 2)' flowId='tst_float']
##teamcity[testFinished name='floatComparisons(should PASS 2)' flowId='tst_float']
@ -124,7 +124,7 @@
##teamcity[testStarted name='floatComparisons(should PASS 3)' flowId='tst_float']
##teamcity[testFinished name='floatComparisons(should PASS 3)' flowId='tst_float']
##teamcity[testStarted name='floatComparisons(should FAIL 4)' flowId='tst_float']
##teamcity[testFailed name='floatComparisons(should FAIL 4)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared floats are not the same (fuzzy compare)|n Actual (operandLeft) : 9.9999e-40|n Expected (operandRight): 9.99971e-40' flowId='tst_float']
##teamcity[testFailed name='floatComparisons(should FAIL 4)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared floats are not the same (fuzzy compare)|n Actual (operandLeft) : 1.00001e-05|n Expected (operandRight): 9.9999e-06' flowId='tst_float']
##teamcity[testFinished name='floatComparisons(should FAIL 4)' flowId='tst_float']
##teamcity[testStarted name='floatComparisons(should PASS 4)' flowId='tst_float']
##teamcity[testFinished name='floatComparisons(should PASS 4)' flowId='tst_float']
@ -221,7 +221,7 @@
##teamcity[testStarted name='float16Comparisons(should PASS 1)' flowId='tst_float']
##teamcity[testFinished name='float16Comparisons(should PASS 1)' flowId='tst_float']
##teamcity[testStarted name='float16Comparisons(should FAIL 2)' flowId='tst_float']
##teamcity[testFailed name='float16Comparisons(should FAIL 2)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : 0.0001|n Expected (operandRight): 0.0003' flowId='tst_float']
##teamcity[testFailed name='float16Comparisons(should FAIL 2)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : 0.000999|n Expected (operandRight): 0.003' flowId='tst_float']
##teamcity[testFinished name='float16Comparisons(should FAIL 2)' flowId='tst_float']
##teamcity[testStarted name='float16Comparisons(should PASS 2)' flowId='tst_float']
##teamcity[testFinished name='float16Comparisons(should PASS 2)' flowId='tst_float']
@ -231,7 +231,7 @@
##teamcity[testStarted name='float16Comparisons(should PASS 3)' flowId='tst_float']
##teamcity[testFinished name='float16Comparisons(should PASS 3)' flowId='tst_float']
##teamcity[testStarted name='float16Comparisons(should FAIL 4)' flowId='tst_float']
##teamcity[testFailed name='float16Comparisons(should FAIL 4)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : 5.93e-05|n Expected (operandRight): 5.87e-05' flowId='tst_float']
##teamcity[testFailed name='float16Comparisons(should FAIL 4)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : 0.00101|n Expected (operandRight): 0.00099' flowId='tst_float']
##teamcity[testFinished name='float16Comparisons(should FAIL 4)' flowId='tst_float']
##teamcity[testStarted name='float16Comparisons(should PASS 4)' flowId='tst_float']
##teamcity[testFinished name='float16Comparisons(should PASS 4)' flowId='tst_float']
@ -325,9 +325,9 @@
##teamcity[testStarted name='compareFloatTests(1e0)' flowId='tst_float']
##teamcity[testFailed name='compareFloatTests(1e0)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared floats are not the same (fuzzy compare)|n Actual (t1): 1|n Expected (t3): 3' flowId='tst_float']
##teamcity[testFinished name='compareFloatTests(1e0)' flowId='tst_float']
##teamcity[testStarted name='compareFloatTests(1e-7)' flowId='tst_float']
##teamcity[testFailed name='compareFloatTests(1e-7)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared floats are not the same (fuzzy compare)|n Actual (t1): 1e-07|n Expected (t3): 3e-07' flowId='tst_float']
##teamcity[testFinished name='compareFloatTests(1e-7)' flowId='tst_float']
##teamcity[testStarted name='compareFloatTests(1e-5)' flowId='tst_float']
##teamcity[testFailed name='compareFloatTests(1e-5)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared floats are not the same (fuzzy compare)|n Actual (t1): 1e-05|n Expected (t3): 3e-05' flowId='tst_float']
##teamcity[testFinished name='compareFloatTests(1e-5)' flowId='tst_float']
##teamcity[testStarted name='compareFloatTests(1e+7)' flowId='tst_float']
##teamcity[testFailed name='compareFloatTests(1e+7)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared floats are not the same (fuzzy compare)|n Actual (t1): 1e+07|n Expected (t3): 3e+07' flowId='tst_float']
##teamcity[testFinished name='compareFloatTests(1e+7)' flowId='tst_float']

View File

@ -17,8 +17,8 @@ FAIL! : tst_float::doubleComparisons(should FAIL 3) Compared doubles are not th
Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)]
PASS : tst_float::doubleComparisons(should PASS 3)
FAIL! : tst_float::doubleComparisons(should FAIL 4) Compared doubles are not the same (fuzzy compare)
Actual (operandLeft) : 9.99999999999e-311
Expected (operandRight): 9.99999999997e-311
Actual (operandLeft) : 1e-12
Expected (operandRight): 9.99999999999e-13
Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)]
PASS : tst_float::doubleComparisons(should PASS 4)
FAIL! : tst_float::doubleComparisons(should FAIL 5) Compared doubles are not the same (fuzzy compare)
@ -138,8 +138,8 @@ FAIL! : tst_float::floatComparisons(should FAIL 1) Compared floats are not the
Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)]
PASS : tst_float::floatComparisons(should PASS 1)
FAIL! : tst_float::floatComparisons(should FAIL 2) Compared floats are not the same (fuzzy compare)
Actual (operandLeft) : 1e-07
Expected (operandRight): 3e-07
Actual (operandLeft) : 1e-05
Expected (operandRight): 3e-05
Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)]
PASS : tst_float::floatComparisons(should PASS 2)
FAIL! : tst_float::floatComparisons(should FAIL 3) Compared floats are not the same (fuzzy compare)
@ -148,8 +148,8 @@ FAIL! : tst_float::floatComparisons(should FAIL 3) Compared floats are not the
Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)]
PASS : tst_float::floatComparisons(should PASS 3)
FAIL! : tst_float::floatComparisons(should FAIL 4) Compared floats are not the same (fuzzy compare)
Actual (operandLeft) : 9.9999e-40
Expected (operandRight): 9.99971e-40
Actual (operandLeft) : 1.00001e-05
Expected (operandRight): 9.9999e-06
Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)]
PASS : tst_float::floatComparisons(should PASS 4)
FAIL! : tst_float::floatComparisons(should FAIL 5) Compared floats are not the same (fuzzy compare)
@ -269,8 +269,8 @@ FAIL! : tst_float::float16Comparisons(should FAIL 1) Compared qfloat16s are not
Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)]
PASS : tst_float::float16Comparisons(should PASS 1)
FAIL! : tst_float::float16Comparisons(should FAIL 2) Compared qfloat16s are not the same (fuzzy compare)
Actual (operandLeft) : 0.0001
Expected (operandRight): 0.0003
Actual (operandLeft) : 0.000999
Expected (operandRight): 0.003
Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)]
PASS : tst_float::float16Comparisons(should PASS 2)
FAIL! : tst_float::float16Comparisons(should FAIL 3) Compared qfloat16s are not the same (fuzzy compare)
@ -279,8 +279,8 @@ FAIL! : tst_float::float16Comparisons(should FAIL 3) Compared qfloat16s are not
Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)]
PASS : tst_float::float16Comparisons(should PASS 3)
FAIL! : tst_float::float16Comparisons(should FAIL 4) Compared qfloat16s are not the same (fuzzy compare)
Actual (operandLeft) : 5.93e-05
Expected (operandRight): 5.87e-05
Actual (operandLeft) : 0.00101
Expected (operandRight): 0.00099
Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)]
PASS : tst_float::float16Comparisons(should PASS 4)
FAIL! : tst_float::float16Comparisons(should FAIL 5) Compared qfloat16s are not the same (fuzzy compare)
@ -398,9 +398,9 @@ FAIL! : tst_float::compareFloatTests(1e0) Compared floats are not the same (fuz
Actual (t1): 1
Expected (t3): 3
Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)]
FAIL! : tst_float::compareFloatTests(1e-7) Compared floats are not the same (fuzzy compare)
Actual (t1): 1e-07
Expected (t3): 3e-07
FAIL! : tst_float::compareFloatTests(1e-5) Compared floats are not the same (fuzzy compare)
Actual (t1): 1e-05
Expected (t3): 3e-05
Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)]
FAIL! : tst_float::compareFloatTests(1e+7) Compared floats are not the same (fuzzy compare)
Actual (t1): 1e+07

View File

@ -40,8 +40,8 @@
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0">
<DataTag><![CDATA[should FAIL 4]]></DataTag>
<Description><![CDATA[Compared doubles are not the same (fuzzy compare)
Actual (operandLeft) : 9.99999999999e-311
Expected (operandRight): 9.99999999997e-311]]></Description>
Actual (operandLeft) : 1e-12
Expected (operandRight): 9.99999999999e-13]]></Description>
</Incident>
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[should PASS 4]]></DataTag>
@ -232,8 +232,8 @@
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0">
<DataTag><![CDATA[should FAIL 2]]></DataTag>
<Description><![CDATA[Compared floats are not the same (fuzzy compare)
Actual (operandLeft) : 1e-07
Expected (operandRight): 3e-07]]></Description>
Actual (operandLeft) : 1e-05
Expected (operandRight): 3e-05]]></Description>
</Incident>
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[should PASS 2]]></DataTag>
@ -250,8 +250,8 @@
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0">
<DataTag><![CDATA[should FAIL 4]]></DataTag>
<Description><![CDATA[Compared floats are not the same (fuzzy compare)
Actual (operandLeft) : 9.9999e-40
Expected (operandRight): 9.99971e-40]]></Description>
Actual (operandLeft) : 1.00001e-05
Expected (operandRight): 9.9999e-06]]></Description>
</Incident>
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[should PASS 4]]></DataTag>
@ -442,8 +442,8 @@
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0">
<DataTag><![CDATA[should FAIL 2]]></DataTag>
<Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare)
Actual (operandLeft) : 0.0001
Expected (operandRight): 0.0003]]></Description>
Actual (operandLeft) : 0.000999
Expected (operandRight): 0.003]]></Description>
</Incident>
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[should PASS 2]]></DataTag>
@ -460,8 +460,8 @@
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0">
<DataTag><![CDATA[should FAIL 4]]></DataTag>
<Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare)
Actual (operandLeft) : 5.93e-05
Expected (operandRight): 5.87e-05]]></Description>
Actual (operandLeft) : 0.00101
Expected (operandRight): 0.00099]]></Description>
</Incident>
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[should PASS 4]]></DataTag>
@ -647,10 +647,10 @@
Expected (t3): 3]]></Description>
</Incident>
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0">
<DataTag><![CDATA[1e-7]]></DataTag>
<DataTag><![CDATA[1e-5]]></DataTag>
<Description><![CDATA[Compared floats are not the same (fuzzy compare)
Actual (t1): 1e-07
Expected (t3): 3e-07]]></Description>
Actual (t1): 1e-05
Expected (t3): 3e-05]]></Description>
</Incident>
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0">
<DataTag><![CDATA[1e+7]]></DataTag>

View File

@ -1,9 +1,10 @@
SOURCES += tst_float.cpp
QT = core testlib
mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
INCLUDEPATH += ../../../../shared/
HEADERS = ../../../../shared/emulationdetector.h
SOURCES += tst_float.cpp
TARGET = float
include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@ -31,6 +31,8 @@
#include <QtTest/QtTest>
#include <QDebug>
#include "emulationdetector.h"
// Test proper handling of floating-point types
class tst_float: public QObject
{
@ -113,16 +115,18 @@ void tst_float::doubleComparisons_data() const
QTest::newRow("should PASS 1") << zero << zero;
QTest::newRow("should FAIL 2") << 1.e-7 << 3.e-7;
// QCOMPARE for doubles uses qFuzzyCompare(), which succeeds if the numbers
// differ by no more than 1e-12 times the smaller value. Thus
// QCOMPARE(1e12-2, 1e12-1) should fail, while QCOMPARE(1e12+1, 1e12+2)
// should pass.
// QCOMPARE() uses qFuzzyCompare(), which succeeds if doubles differ by no
// more than 1e-12 times the smaller value; but QCOMPARE() also considers
// values equal if qFuzzyIsNull() is true for both, so all doubles smaller
// than 1e-12 are equal. Thus QCOMPARE(1e12-2, 1e12-1) should fail, while
// QCOMPARE(1e12+1, 1e12+2) should pass, as should QCOMPARE(1e-12-2e-24,
// 1e-12-1e-24), despite the values differing by more than one part in 1e12.
QTest::newRow("should PASS 2") << 1e12 + one << 1e12 + 2.;
QTest::newRow("should FAIL 3") << 1e12 - one << 1e12 - 2.;
QTest::newRow("should PASS 3") << 1e-12 << -1e-12;
// ... but rounding makes that a bit unrelaible when scaled close to the bounds.
QTest::newRow("should PASS 3") << 1e-310 + 1e-322 << 1e-310 + 2e-322;
QTest::newRow("should FAIL 4") << 1e-310 - 1e-322 << 1e-310 - 3e-322;
QTest::newRow("should FAIL 4") << 1e-12 + 1e-24 << 1e-12 - 1e-24;
QTest::newRow("should PASS 4") << 1e307 + 1e295 << 1e307 + 2e295;
QTest::newRow("should FAIL 5") << 1e307 - 1e295 << 1e307 - 3e295;
@ -145,18 +149,20 @@ void tst_float::floatComparisons_data() const
QTest::newRow("should FAIL 1") << one << 3.f;
QTest::newRow("should PASS 1") << zero << zero;
QTest::newRow("should FAIL 2") << 1.e-7f << 3.e-7f;
QTest::newRow("should FAIL 2") << 1.e-5f << 3.e-5f;
// QCOMPARE for floats uses qFuzzyCompare(), which succeeds if the numbers
// differ by no more than 1e-5 times the smaller value. Thus
// QCOMPARE(1e5-2, 1e5-1) should fail, while QCOMPARE(1e5+1, 1e5+2)
// should pass.
// QCOMPARE() uses qFuzzyCompare(), which succeeds if the floats differ by
// no more than 1e-5 times the smaller value; but QCOMPARE() also considers
// values equal if qFuzzyIsNull is true for both, so all floats smaller than
// 1e-5 are equal. Thus QCOMPARE(1e5-2, 1e5-1) should fail, while
// QCOMPARE(1e5+1, 1e5+2) should pass, as should QCOMPARE(1e-5-2e-10,
// 1e-5-1e-10), despite the values differing by more than one part in 1e5.
QTest::newRow("should PASS 2") << 1e5f + one << 1e5f + 2.f;
QTest::newRow("should FAIL 3") << 1e5f - one << 1e5f - 2.f;
QTest::newRow("should PASS 3") << 1e-5f << -1e-5f;
// ... but rounding makes that a bit unrelaible when scaled close to the bounds.
QTest::newRow("should PASS 3") << 1e-39f + 1e-44f << 1e-39f + 2e-44f;
QTest::newRow("should FAIL 4") << 1e-39f - 1e-44f << 1e-39f - 3e-44f;
QTest::newRow("should FAIL 4") << 1e-5f + 1e-10f << 1e-5f - 1e-10f;
QTest::newRow("should PASS 4") << 1e38f + 1e33f << 1e38f + 2e33f;
QTest::newRow("should FAIL 5") << 1e38f - 1e33f << 1e38f - 3e33f;
@ -175,18 +181,21 @@ void tst_float::float16Comparisons_data() const
{
QTest::addColumn<qfloat16>("operandLeft");
QTest::addColumn<qfloat16>("operandRight");
qfloat16 zero(0), one(1);
const qfloat16 zero(0), one(1);
const qfloat16 tiny(EmulationDetector::isRunningArmOnX86() ? 0.00099f : 0.001f);
QTest::newRow("should FAIL 1") << one << qfloat16(3);
QTest::newRow("should PASS 1") << zero << zero;
QTest::newRow("should FAIL 2") << qfloat16(1e-4f) << qfloat16(3e-4f);
QTest::newRow("should FAIL 2") << qfloat16(1e-3f) << qfloat16(3e-3f);
// QCOMPARE for qfloat16s uses qFuzzyCompare()
// QCOMPARE for uses qFuzzyCompare(), which ignores differences of one part
// in 102.5 and considers any two qFuzzyIsNull() values, i.e. values smaller
// than 1e-3, equal
QTest::newRow("should PASS 2") << qfloat16(1001) << qfloat16(1002);
QTest::newRow("should FAIL 3") << qfloat16(98) << qfloat16(99);
QTest::newRow("should PASS 3") << tiny << -tiny;
// ... which gets a bit unreliable near to the type's bounds
QTest::newRow("should PASS 3") << qfloat16(6e-5f) + qfloat16(6e-7f) << qfloat16(6e-5f) + qfloat16(11e-7f);
QTest::newRow("should FAIL 4") << qfloat16(6e-5f) - qfloat16(7e-7f) << qfloat16(6e-5f) - qfloat16(13e-7f);
QTest::newRow("should FAIL 4") << qfloat16(1.01e-3f) << qfloat16(0.99e-3f);
QTest::newRow("should PASS 4") << qfloat16(6e4) + qfloat16(700) << qfloat16(6e4) + qfloat16(1200);
QTest::newRow("should FAIL 5") << qfloat16(6e4) - qfloat16(600) << qfloat16(6e4) - qfloat16(1200);
@ -200,7 +209,7 @@ void tst_float::compareFloatTests() const
// Create two more values
// t2 differs from t1 by 1 ppm (part per million)
// t3 differs from t1 by 200%
// we should consider that t1 == t2 and t1 != t3
// We should consider that t1 == t2 and t1 != t3 (provided at least one is > 1e-5)
const float t2 = t1 + (t1 / 1e6);
const float t3 = 3 * t1;
@ -214,7 +223,7 @@ void tst_float::compareFloatTests_data() const
{
QTest::addColumn<float>("t1");
QTest::newRow("1e0") << 1e0f;
QTest::newRow("1e-7") << 1e-7f;
QTest::newRow("1e-5") << 1e-5f;
QTest::newRow("1e+7") << 1e+7f;
}

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2020 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
@ -940,6 +940,14 @@ bool tst_Selftests::compareLine(const QString &logger, const QString &subdir,
return true;
}
if (EmulationDetector::isRunningArmOnX86() && subdir == QLatin1String("float")) {
// QEMU cheats at qfloat16, so outputs it as if it were a float.
if (actualLine.endsWith(QLatin1String("Actual (operandLeft) : 0.001"))
&& expectedLine.endsWith(QLatin1String("Actual (operandLeft) : 0.000999"))) {
return true;
}
}
*errorMessage = msgMismatch(actualLine, expectedLine);
return false;
}