summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/testlib/selftests/expected_float.lightxml44
-rw-r--r--tests/auto/testlib/selftests/expected_float.txt26
-rw-r--r--tests/auto/testlib/selftests/expected_float.xml47
-rw-r--r--tests/auto/testlib/selftests/expected_float.xunitxml29
-rw-r--r--tests/auto/testlib/selftests/expected_subtest.lightxml144
-rw-r--r--tests/auto/testlib/selftests/expected_subtest.txt104
-rw-r--r--tests/auto/testlib/selftests/expected_subtest.xml153
-rw-r--r--tests/auto/testlib/selftests/expected_subtest.xunitxml96
-rw-r--r--tests/auto/testlib/selftests/float/float.pro12
-rw-r--r--tests/auto/testlib/selftests/float/tst_float.cpp113
-rw-r--r--tests/auto/testlib/selftests/selftests.pro2
-rw-r--r--tests/auto/testlib/selftests/selftests.qrc4
-rw-r--r--tests/auto/testlib/selftests/subtest/tst_subtest.cpp122
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp5
14 files changed, 655 insertions, 246 deletions
diff --git a/tests/auto/testlib/selftests/expected_float.lightxml b/tests/auto/testlib/selftests/expected_float.lightxml
new file mode 100644
index 0000000000..a34618cf02
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_float.lightxml
@@ -0,0 +1,44 @@
+<Environment>
+ <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
+</Environment>
+<TestFunction name="initTestCase">
+<Incident type="pass" file="" line="0" />
+</TestFunction>
+<TestFunction name="floatComparisons">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="61">
+ <DataTag><![CDATA[should FAIL]]></DataTag>
+ <Description><![CDATA[Compared floats are not the same (fuzzy compare)
+ Actual (operandLeft): 1
+ Expected (operandRight): 3]]></Description>
+</Incident>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="61">
+ <DataTag><![CDATA[should FAIL]]></DataTag>
+ <Description><![CDATA[Compared floats are not the same (fuzzy compare)
+ Actual (operandLeft): 1e-07
+ Expected (operandRight): 3e-07]]></Description>
+</Incident>
+</TestFunction>
+<TestFunction name="compareFloatTests">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="100">
+ <DataTag><![CDATA[1e0]]></DataTag>
+ <Description><![CDATA[Compared floats are not the same (fuzzy compare)
+ Actual (t1): 1
+ Expected (t3): 3]]></Description>
+</Incident>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="100">
+ <DataTag><![CDATA[1e-7]]></DataTag>
+ <Description><![CDATA[Compared floats are not the same (fuzzy compare)
+ Actual (t1): 1e-07
+ Expected (t3): 3e-07]]></Description>
+</Incident>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="100">
+ <DataTag><![CDATA[1e+7]]></DataTag>
+ <Description><![CDATA[Compared floats are not the same (fuzzy compare)
+ Actual (t1): 1e+07
+ Expected (t3): 3e+07]]></Description>
+</Incident>
+</TestFunction>
+<TestFunction name="cleanupTestCase">
+<Incident type="pass" file="" line="0" />
+</TestFunction>
diff --git a/tests/auto/testlib/selftests/expected_float.txt b/tests/auto/testlib/selftests/expected_float.txt
new file mode 100644
index 0000000000..322fc5ce44
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_float.txt
@@ -0,0 +1,26 @@
+********* Start testing of tst_float *********
+Config: Using QTest library 5.0.0, Qt 5.0.0
+PASS : tst_float::initTestCase()
+FAIL! : tst_float::floatComparisons(should FAIL) Compared floats are not the same (fuzzy compare)
+ Actual (operandLeft): 1
+ Expected (operandRight): 3
+ Loc: [/home/user/dev/qt5/tests/auto/testlib/selftests/float/tst_float.cpp(61)]
+FAIL! : tst_float::floatComparisons(should FAIL) Compared floats are not the same (fuzzy compare)
+ Actual (operandLeft): 1e-07
+ Expected (operandRight): 3e-07
+ Loc: [/home/user/dev/qt5/tests/auto/testlib/selftests/float/tst_float.cpp(61)]
+FAIL! : tst_float::compareFloatTests(1e0) Compared floats are not the same (fuzzy compare)
+ Actual (t1): 1
+ Expected (t3): 3
+ Loc: [/home/user/dev/qt5/tests/auto/testlib/selftests/float/tst_float.cpp(100)]
+FAIL! : tst_float::compareFloatTests(1e-7) Compared floats are not the same (fuzzy compare)
+ Actual (t1): 1e-07
+ Expected (t3): 3e-07
+ Loc: [/home/user/dev/qt5/tests/auto/testlib/selftests/float/tst_float.cpp(100)]
+FAIL! : tst_float::compareFloatTests(1e+7) Compared floats are not the same (fuzzy compare)
+ Actual (t1): 1e+07
+ Expected (t3): 3e+07
+ Loc: [/home/user/dev/qt5/tests/auto/testlib/selftests/float/tst_float.cpp(100)]
+PASS : tst_float::cleanupTestCase()
+Totals: 2 passed, 5 failed, 0 skipped
+********* Finished testing of tst_float *********
diff --git a/tests/auto/testlib/selftests/expected_float.xml b/tests/auto/testlib/selftests/expected_float.xml
new file mode 100644
index 0000000000..a9c7428250
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_float.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<TestCase name="tst_float">
+<Environment>
+ <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
+</Environment>
+<TestFunction name="initTestCase">
+<Incident type="pass" file="" line="0" />
+</TestFunction>
+<TestFunction name="floatComparisons">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="61">
+ <DataTag><![CDATA[should FAIL]]></DataTag>
+ <Description><![CDATA[Compared floats are not the same (fuzzy compare)
+ Actual (operandLeft): 1
+ Expected (operandRight): 3]]></Description>
+</Incident>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="61">
+ <DataTag><![CDATA[should FAIL]]></DataTag>
+ <Description><![CDATA[Compared floats are not the same (fuzzy compare)
+ Actual (operandLeft): 1e-07
+ Expected (operandRight): 3e-07]]></Description>
+</Incident>
+</TestFunction>
+<TestFunction name="compareFloatTests">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="100">
+ <DataTag><![CDATA[1e0]]></DataTag>
+ <Description><![CDATA[Compared floats are not the same (fuzzy compare)
+ Actual (t1): 1
+ Expected (t3): 3]]></Description>
+</Incident>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="100">
+ <DataTag><![CDATA[1e-7]]></DataTag>
+ <Description><![CDATA[Compared floats are not the same (fuzzy compare)
+ Actual (t1): 1e-07
+ Expected (t3): 3e-07]]></Description>
+</Incident>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="100">
+ <DataTag><![CDATA[1e+7]]></DataTag>
+ <Description><![CDATA[Compared floats are not the same (fuzzy compare)
+ Actual (t1): 1e+07
+ Expected (t3): 3e+07]]></Description>
+</Incident>
+</TestFunction>
+<TestFunction name="cleanupTestCase">
+<Incident type="pass" file="" line="0" />
+</TestFunction>
+</TestCase>
diff --git a/tests/auto/testlib/selftests/expected_float.xunitxml b/tests/auto/testlib/selftests/expected_float.xunitxml
new file mode 100644
index 0000000000..f88e5e410e
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_float.xunitxml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<testsuite errors="0" failures="5" tests="4" name="tst_float">
+ <properties>
+ <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
+ <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
+ </properties>
+ <testcase result="pass" name="initTestCase"/>
+ <testcase result="fail" name="floatComparisons">
+ <failure tag="should FAIL" message="Compared floats are not the same (fuzzy compare)
+ Actual (operandLeft): 1
+ Expected (operandRight): 3" result="fail"/>
+ <failure tag="should FAIL" message="Compared floats are not the same (fuzzy compare)
+ Actual (operandLeft): 1e&#x002D;07
+ Expected (operandRight): 3e&#x002D;07" result="fail"/>
+ </testcase>
+ <testcase result="fail" name="compareFloatTests">
+ <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+7" message="Compared floats are not the same (fuzzy compare)
+ Actual (t1): 1e+07
+ Expected (t3): 3e+07" result="fail"/>
+ </testcase>
+ <testcase result="pass" name="cleanupTestCase"/>
+ <system-err/>
+</testsuite>
diff --git a/tests/auto/testlib/selftests/expected_subtest.lightxml b/tests/auto/testlib/selftests/expected_subtest.lightxml
index 00c1a992bd..d76ec131de 100644
--- a/tests/auto/testlib/selftests/expected_subtest.lightxml
+++ b/tests/auto/testlib/selftests/expected_subtest.lightxml
@@ -3,47 +3,143 @@
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
+<Message type="qdebug" file="" line="0">
+ <Description><![CDATA[initTestCase initTestCase (null) ]]></Description>
+</Message>
<Incident type="pass" file="" line="0" />
</TestFunction>
<TestFunction name="test1">
+<Message type="qdebug" file="" line="0">
+ <Description><![CDATA[init test1 (null) ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <Description><![CDATA[test1 test1 (null) ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <Description><![CDATA[cleanup test1 (null) ]]></Description>
+</Message>
<Incident type="pass" file="" line="0" />
</TestFunction>
<TestFunction name="test2">
+<Message type="qdebug" file="" line="0">
+ <Description><![CDATA[test2_data test2 (null) ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <Description><![CDATA[test2_data end ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data0]]></DataTag>
+ <Description><![CDATA[init test2 data0 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data0]]></DataTag>
+ <Description><![CDATA[test2 test2 data0 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data0]]></DataTag>
+ <Description><![CDATA[test2 end ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data0]]></DataTag>
+ <Description><![CDATA[cleanup test2 data0 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data1]]></DataTag>
+ <Description><![CDATA[init test2 data1 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data1]]></DataTag>
+ <Description><![CDATA[test2 test2 data1 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data1]]></DataTag>
+ <Description><![CDATA[test2 end ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data1]]></DataTag>
+ <Description><![CDATA[cleanup test2 data1 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data2]]></DataTag>
+ <Description><![CDATA[init test2 data2 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data2]]></DataTag>
+ <Description><![CDATA[test2 test2 data2 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data2]]></DataTag>
+ <Description><![CDATA[test2 end ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data2]]></DataTag>
+ <Description><![CDATA[cleanup test2 data2 ]]></Description>
+</Message>
<Incident type="pass" file="" line="0" />
</TestFunction>
<TestFunction name="test3">
-<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/subtest/tst_subtest.cpp" line="157">
+<Message type="qdebug" file="" line="0">
+ <Description><![CDATA[test3_data test3 (null) ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <Description><![CDATA[test3_data end ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data0]]></DataTag>
+ <Description><![CDATA[init test3 data0 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data0]]></DataTag>
+ <Description><![CDATA[test2 test3 data0 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data0]]></DataTag>
+ <Description><![CDATA[test2 end ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data0]]></DataTag>
+ <Description><![CDATA[cleanup test3 data0 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data1]]></DataTag>
+ <Description><![CDATA[init test3 data1 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data1]]></DataTag>
+ <Description><![CDATA[test2 test3 data1 ]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp" line="154">
+ <DataTag><![CDATA[data1]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (str): hello1
Expected (QString("hello0")): hello0]]></Description>
+</Incident>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data1]]></DataTag>
+ <Description><![CDATA[cleanup test3 data1 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data2]]></DataTag>
+ <Description><![CDATA[init test3 data2 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data2]]></DataTag>
+ <Description><![CDATA[test2 test3 data2 ]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp" line="154">
+ <DataTag><![CDATA[data2]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (str): hello2
Expected (QString("hello0")): hello0]]></Description>
</Incident>
-</TestFunction>
-<TestFunction name="floatComparisons">
-<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/subtest/tst_subtest.cpp" line="167">
- <Description><![CDATA[Compared floats are not the same (fuzzy compare)
- Actual (operandLeft): 1
- Expected (operandRight): 3]]></Description>
- <Description><![CDATA[Compared floats are not the same (fuzzy compare)
- Actual (operandLeft): 1e-07
- Expected (operandRight): 3e-07]]></Description>
-</Incident>
-</TestFunction>
-<TestFunction name="compareFloatTests">
-<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/subtest/tst_subtest.cpp" line="206">
- <Description><![CDATA[Compared floats are not the same (fuzzy compare)
- Actual (t1): 1
- Expected (t3): 3]]></Description>
- <Description><![CDATA[Compared floats are not the same (fuzzy compare)
- Actual (t1): 1e-07
- Expected (t3): 3e-07]]></Description>
- <Description><![CDATA[Compared floats are not the same (fuzzy compare)
- Actual (t1): 1e+07
- Expected (t3): 3e+07]]></Description>
-</Incident>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data2]]></DataTag>
+ <Description><![CDATA[cleanup test3 data2 ]]></Description>
+</Message>
</TestFunction>
<TestFunction name="cleanupTestCase">
+<Message type="qdebug" file="" line="0">
+ <Description><![CDATA[cleanupTestCase cleanupTestCase (null) ]]></Description>
+</Message>
<Incident type="pass" file="" line="0" />
</TestFunction>
diff --git a/tests/auto/testlib/selftests/expected_subtest.txt b/tests/auto/testlib/selftests/expected_subtest.txt
index ec459c5b59..cf995887d0 100644
--- a/tests/auto/testlib/selftests/expected_subtest.txt
+++ b/tests/auto/testlib/selftests/expected_subtest.txt
@@ -1,81 +1,47 @@
********* Start testing of tst_Subtest *********
-Config: Using QTest library 4.4.0, Qt 4.4.0
-initTestCase initTestCase (null)
+Config: Using QTest library 5.0.0, Qt 5.0.0
+QDEBUG : tst_Subtest::initTestCase() initTestCase initTestCase (null)
PASS : tst_Subtest::initTestCase()
-init test1 (null)
-test1 test1 (null)
-cleanup test1 (null)
+QDEBUG : tst_Subtest::test1() init test1 (null)
+QDEBUG : tst_Subtest::test1() test1 test1 (null)
+QDEBUG : tst_Subtest::test1() cleanup test1 (null)
PASS : tst_Subtest::test1()
-test2_data test2 (null)
-test2_data end
-init test2 data0
-test2 test2 data0
-test2 end
-cleanup test2 data0
-init test2 data1
-test2 test2 data1
-test2 end
-cleanup test2 data1
-init test2 data2
-test2 test2 data2
-test2 end
-cleanup test2 data2
+QDEBUG : tst_Subtest::test2() test2_data test2 (null)
+QDEBUG : tst_Subtest::test2() test2_data end
+QDEBUG : tst_Subtest::test2(data0) init test2 data0
+QDEBUG : tst_Subtest::test2(data0) test2 test2 data0
+QDEBUG : tst_Subtest::test2(data0) test2 end
+QDEBUG : tst_Subtest::test2(data0) cleanup test2 data0
+QDEBUG : tst_Subtest::test2(data1) init test2 data1
+QDEBUG : tst_Subtest::test2(data1) test2 test2 data1
+QDEBUG : tst_Subtest::test2(data1) test2 end
+QDEBUG : tst_Subtest::test2(data1) cleanup test2 data1
+QDEBUG : tst_Subtest::test2(data2) init test2 data2
+QDEBUG : tst_Subtest::test2(data2) test2 test2 data2
+QDEBUG : tst_Subtest::test2(data2) test2 end
+QDEBUG : tst_Subtest::test2(data2) cleanup test2 data2
PASS : tst_Subtest::test2()
-test3_data test3 (null)
-test3_data end
-init test3 data0
-test2 test3 data0
-test2 end
-cleanup test3 data0
-init test3 data1
-test2 test3 data1
+QDEBUG : tst_Subtest::test3() test3_data test3 (null)
+QDEBUG : tst_Subtest::test3() test3_data end
+QDEBUG : tst_Subtest::test3(data0) init test3 data0
+QDEBUG : tst_Subtest::test3(data0) test2 test3 data0
+QDEBUG : tst_Subtest::test3(data0) test2 end
+QDEBUG : tst_Subtest::test3(data0) cleanup test3 data0
+QDEBUG : tst_Subtest::test3(data1) init test3 data1
+QDEBUG : tst_Subtest::test3(data1) test2 test3 data1
FAIL! : tst_Subtest::test3(data1) Compared values are not the same
Actual (str): hello1
Expected (QString("hello0")): hello0
- Loc: [/home/fenglich/dev/qt-4.4/tests/auto/selftests/subtest/tst_subtest.cpp(124)]
-cleanup test3 data1
-init test3 data2
-test2 test3 data2
+ Loc: [/home/user/dev/qt5/tests/auto/testlib/selftests/subtest/tst_subtest.cpp(154)]
+QDEBUG : tst_Subtest::test3(data1) cleanup test3 data1
+QDEBUG : tst_Subtest::test3(data2) init test3 data2
+QDEBUG : tst_Subtest::test3(data2) test2 test3 data2
FAIL! : tst_Subtest::test3(data2) Compared values are not the same
Actual (str): hello2
Expected (QString("hello0")): hello0
- Loc: [/home/fenglich/dev/qt-4.4/tests/auto/selftests/subtest/tst_subtest.cpp(124)]
-cleanup test3 data2
-init floatComparisons should SUCCEED
-cleanup floatComparisons should SUCCEED
-init floatComparisons should FAIL
-FAIL! : tst_Subtest::floatComparisons(should FAIL) Compared floats are not the same (fuzzy compare)
- Actual (operandLeft): 1
- Expected (operandRight): 3
- Loc: [/home/fenglich/dev/qt-4.4/tests/auto/selftests/subtest/tst_subtest.cpp(134)]
-cleanup floatComparisons should FAIL
-init floatComparisons should FAIL
-FAIL! : tst_Subtest::floatComparisons(should FAIL) Compared floats are not the same (fuzzy compare)
- Actual (operandLeft): 1e-07
- Expected (operandRight): 3e-07
- Loc: [/home/fenglich/dev/qt-4.4/tests/auto/selftests/subtest/tst_subtest.cpp(134)]
-cleanup floatComparisons should FAIL
-init floatComparisons should FAIL
-cleanup floatComparisons should FAIL
-init compareFloatTests 1e0
-FAIL! : tst_Subtest::compareFloatTests(1e0) Compared floats are not the same (fuzzy compare)
- Actual (t1): 1
- Expected (t3): 3
- Loc: [/home/fenglich/dev/qt-4.4/tests/auto/selftests/subtest/tst_subtest.cpp(173)]
-cleanup compareFloatTests 1e0
-init compareFloatTests 1e-7
-FAIL! : tst_Subtest::compareFloatTests(1e-7) Compared floats are not the same (fuzzy compare)
- Actual (t1): 1e-07
- Expected (t3): 3e-07
- Loc: [/home/fenglich/dev/qt-4.4/tests/auto/selftests/subtest/tst_subtest.cpp(173)]
-cleanup compareFloatTests 1e-7
-init compareFloatTests 1e+7
-FAIL! : tst_Subtest::compareFloatTests(1e+7) Compared floats are not the same (fuzzy compare)
- Actual (t1): 1e+07
- Expected (t3): 3e+07
- Loc: [/home/fenglich/dev/qt-4.4/tests/auto/selftests/subtest/tst_subtest.cpp(173)]
-cleanup compareFloatTests 1e+7
-cleanupTestCase cleanupTestCase (null)
+ Loc: [/home/user/dev/qt5/tests/auto/testlib/selftests/subtest/tst_subtest.cpp(154)]
+QDEBUG : tst_Subtest::test3(data2) cleanup test3 data2
+QDEBUG : tst_Subtest::cleanupTestCase() cleanupTestCase cleanupTestCase (null)
PASS : tst_Subtest::cleanupTestCase()
-Totals: 4 passed, 7 failed, 0 skipped
+Totals: 4 passed, 2 failed, 0 skipped
********* Finished testing of tst_Subtest *********
diff --git a/tests/auto/testlib/selftests/expected_subtest.xml b/tests/auto/testlib/selftests/expected_subtest.xml
index 5ecb0a2e9f..d79242f061 100644
--- a/tests/auto/testlib/selftests/expected_subtest.xml
+++ b/tests/auto/testlib/selftests/expected_subtest.xml
@@ -5,63 +5,144 @@
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
+<Message type="qdebug" file="" line="0">
+ <Description><![CDATA[initTestCase initTestCase (null) ]]></Description>
+</Message>
<Incident type="pass" file="" line="0" />
</TestFunction>
<TestFunction name="test1">
+<Message type="qdebug" file="" line="0">
+ <Description><![CDATA[init test1 (null) ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <Description><![CDATA[test1 test1 (null) ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <Description><![CDATA[cleanup test1 (null) ]]></Description>
+</Message>
<Incident type="pass" file="" line="0" />
</TestFunction>
<TestFunction name="test2">
+<Message type="qdebug" file="" line="0">
+ <Description><![CDATA[test2_data test2 (null) ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <Description><![CDATA[test2_data end ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data0]]></DataTag>
+ <Description><![CDATA[init test2 data0 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data0]]></DataTag>
+ <Description><![CDATA[test2 test2 data0 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data0]]></DataTag>
+ <Description><![CDATA[test2 end ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data0]]></DataTag>
+ <Description><![CDATA[cleanup test2 data0 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data1]]></DataTag>
+ <Description><![CDATA[init test2 data1 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data1]]></DataTag>
+ <Description><![CDATA[test2 test2 data1 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data1]]></DataTag>
+ <Description><![CDATA[test2 end ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data1]]></DataTag>
+ <Description><![CDATA[cleanup test2 data1 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data2]]></DataTag>
+ <Description><![CDATA[init test2 data2 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data2]]></DataTag>
+ <Description><![CDATA[test2 test2 data2 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data2]]></DataTag>
+ <Description><![CDATA[test2 end ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data2]]></DataTag>
+ <Description><![CDATA[cleanup test2 data2 ]]></Description>
+</Message>
<Incident type="pass" file="" line="0" />
</TestFunction>
<TestFunction name="test3">
-<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/subtest/tst_subtest.cpp" line="157">
+<Message type="qdebug" file="" line="0">
+ <Description><![CDATA[test3_data test3 (null) ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <Description><![CDATA[test3_data end ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data0]]></DataTag>
+ <Description><![CDATA[init test3 data0 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data0]]></DataTag>
+ <Description><![CDATA[test2 test3 data0 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data0]]></DataTag>
+ <Description><![CDATA[test2 end ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data0]]></DataTag>
+ <Description><![CDATA[cleanup test3 data0 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data1]]></DataTag>
+ <Description><![CDATA[init test3 data1 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data1]]></DataTag>
+ <Description><![CDATA[test2 test3 data1 ]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp" line="154">
<DataTag><![CDATA[data1]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (str): hello1
Expected (QString("hello0")): hello0]]></Description>
</Incident>
-<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/subtest/tst_subtest.cpp" line="157">
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data1]]></DataTag>
+ <Description><![CDATA[cleanup test3 data1 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data2]]></DataTag>
+ <Description><![CDATA[init test3 data2 ]]></Description>
+</Message>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data2]]></DataTag>
+ <Description><![CDATA[test2 test3 data2 ]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp" line="154">
<DataTag><![CDATA[data2]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (str): hello2
Expected (QString("hello0")): hello0]]></Description>
</Incident>
-</TestFunction>
-<TestFunction name="floatComparisons">
-<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/subtest/tst_subtest.cpp" line="167">
- <DataTag><![CDATA[should FAIL]]></DataTag>
- <Description><![CDATA[Compared floats are not the same (fuzzy compare)
- Actual (operandLeft): 1
- Expected (operandRight): 3]]></Description>
-</Incident>
-<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/subtest/tst_subtest.cpp" line="167">
- <DataTag><![CDATA[should FAIL]]></DataTag>
- <Description><![CDATA[Compared floats are not the same (fuzzy compare)
- Actual (operandLeft): 1e-07
- Expected (operandRight): 3e-07]]></Description>
-</Incident>
-</TestFunction>
-<TestFunction name="compareFloatTests">
-<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/subtest/tst_subtest.cpp" line="206">
- <DataTag><![CDATA[1e0]]></DataTag>
- <Description><![CDATA[Compared floats are not the same (fuzzy compare)
- Actual (t1): 1
- Expected (t3): 3]]></Description>
-</Incident>
-<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/subtest/tst_subtest.cpp" line="206">
- <DataTag><![CDATA[1e-7]]></DataTag>
- <Description><![CDATA[Compared floats are not the same (fuzzy compare)
- Actual (t1): 1e-07
- Expected (t3): 3e-07]]></Description>
-</Incident>
-<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/subtest/tst_subtest.cpp" line="206">
- <DataTag><![CDATA[1e+7]]></DataTag>
- <Description><![CDATA[Compared floats are not the same (fuzzy compare)
- Actual (t1): 1e+07
- Expected (t3): 3e+07]]></Description>
-</Incident>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[data2]]></DataTag>
+ <Description><![CDATA[cleanup test3 data2 ]]></Description>
+</Message>
</TestFunction>
<TestFunction name="cleanupTestCase">
+<Message type="qdebug" file="" line="0">
+ <Description><![CDATA[cleanupTestCase cleanupTestCase (null) ]]></Description>
+</Message>
<Incident type="pass" file="" line="0" />
</TestFunction>
</TestCase>
diff --git a/tests/auto/testlib/selftests/expected_subtest.xunitxml b/tests/auto/testlib/selftests/expected_subtest.xunitxml
index a5f75fe73e..c228dc8f54 100644
--- a/tests/auto/testlib/selftests/expected_subtest.xunitxml
+++ b/tests/auto/testlib/selftests/expected_subtest.xunitxml
@@ -1,39 +1,87 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<testsuite errors="0" failures="7" tests="7" name="tst_Subtest">
+<testsuite errors="31" failures="2" tests="5" name="tst_Subtest">
<properties>
<property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
<property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
</properties>
- <testcase result="pass" name="initTestCase"/>
- <testcase result="pass" name="test1"/>
- <testcase result="pass" name="test2"/>
+ <testcase result="pass" name="initTestCase">
+ <!-- message="initTestCase initTestCase (null) " type="qdebug" -->
+ </testcase>
+ <testcase result="pass" name="test1">
+ <!-- message="init test1 (null) " type="qdebug" -->
+ <!-- message="test1 test1 (null) " type="qdebug" -->
+ <!-- message="cleanup test1 (null) " type="qdebug" -->
+ </testcase>
+ <testcase result="pass" name="test2">
+ <!-- message="test2_data test2 (null) " type="qdebug" -->
+ <!-- message="test2_data end " type="qdebug" -->
+ <!-- tag="data0" message="init test2 data0 " type="qdebug" -->
+ <!-- tag="data0" message="test2 test2 data0 " type="qdebug" -->
+ <!-- tag="data0" message="test2 end " type="qdebug" -->
+ <!-- tag="data0" message="cleanup test2 data0 " type="qdebug" -->
+ <!-- tag="data1" message="init test2 data1 " type="qdebug" -->
+ <!-- tag="data1" message="test2 test2 data1 " type="qdebug" -->
+ <!-- tag="data1" message="test2 end " type="qdebug" -->
+ <!-- tag="data1" message="cleanup test2 data1 " type="qdebug" -->
+ <!-- tag="data2" message="init test2 data2 " type="qdebug" -->
+ <!-- tag="data2" message="test2 test2 data2 " type="qdebug" -->
+ <!-- tag="data2" message="test2 end " type="qdebug" -->
+ <!-- tag="data2" message="cleanup test2 data2 " type="qdebug" -->
+ </testcase>
<testcase result="fail" name="test3">
+ <!-- message="test3_data test3 (null) " type="qdebug" -->
+ <!-- message="test3_data end " type="qdebug" -->
+ <!-- tag="data0" message="init test3 data0 " type="qdebug" -->
+ <!-- tag="data0" message="test2 test3 data0 " type="qdebug" -->
+ <!-- tag="data0" message="test2 end " type="qdebug" -->
+ <!-- tag="data0" message="cleanup test3 data0 " type="qdebug" -->
+ <!-- tag="data1" message="init test3 data1 " type="qdebug" -->
+ <!-- tag="data1" message="test2 test3 data1 " type="qdebug" -->
<failure tag="data1" message="Compared values are not the same
Actual (str): hello1
Expected (QString(&quot;hello0&quot;)): hello0" result="fail"/>
+ <!-- tag="data1" message="cleanup test3 data1 " type="qdebug" -->
+ <!-- tag="data2" message="init test3 data2 " type="qdebug" -->
+ <!-- tag="data2" message="test2 test3 data2 " type="qdebug" -->
<failure tag="data2" message="Compared values are not the same
Actual (str): hello2
Expected (QString(&quot;hello0&quot;)): hello0" result="fail"/>
+ <!-- tag="data2" message="cleanup test3 data2 " type="qdebug" -->
</testcase>
- <testcase result="fail" name="floatComparisons">
- <failure tag="should FAIL" message="Compared floats are not the same (fuzzy compare)
- Actual (operandLeft): 1
- Expected (operandRight): 3" result="fail"/>
- <failure tag="should FAIL" message="Compared floats are not the same (fuzzy compare)
- Actual (operandLeft): 1e&#x002D;07
- Expected (operandRight): 3e&#x002D;07" result="fail"/>
- </testcase>
- <testcase result="fail" name="compareFloatTests">
- <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+7" message="Compared floats are not the same (fuzzy compare)
- Actual (t1): 1e+07
- Expected (t3): 3e+07" result="fail"/>
+ <testcase result="pass" name="cleanupTestCase">
+ <!-- message="cleanupTestCase cleanupTestCase (null) " type="qdebug" -->
</testcase>
- <testcase result="pass" name="cleanupTestCase"/>
- <system-err/>
+ <system-err>
+<![CDATA[initTestCase initTestCase (null) ]]>
+<![CDATA[init test1 (null) ]]>
+<![CDATA[test1 test1 (null) ]]>
+<![CDATA[cleanup test1 (null) ]]>
+<![CDATA[test2_data test2 (null) ]]>
+<![CDATA[test2_data end ]]>
+<![CDATA[init test2 data0 ]]>
+<![CDATA[test2 test2 data0 ]]>
+<![CDATA[test2 end ]]>
+<![CDATA[cleanup test2 data0 ]]>
+<![CDATA[init test2 data1 ]]>
+<![CDATA[test2 test2 data1 ]]>
+<![CDATA[test2 end ]]>
+<![CDATA[cleanup test2 data1 ]]>
+<![CDATA[init test2 data2 ]]>
+<![CDATA[test2 test2 data2 ]]>
+<![CDATA[test2 end ]]>
+<![CDATA[cleanup test2 data2 ]]>
+<![CDATA[test3_data test3 (null) ]]>
+<![CDATA[test3_data end ]]>
+<![CDATA[init test3 data0 ]]>
+<![CDATA[test2 test3 data0 ]]>
+<![CDATA[test2 end ]]>
+<![CDATA[cleanup test3 data0 ]]>
+<![CDATA[init test3 data1 ]]>
+<![CDATA[test2 test3 data1 ]]>
+<![CDATA[cleanup test3 data1 ]]>
+<![CDATA[init test3 data2 ]]>
+<![CDATA[test2 test3 data2 ]]>
+<![CDATA[cleanup test3 data2 ]]>
+<![CDATA[cleanupTestCase cleanupTestCase (null) ]]>
+ </system-err>
</testsuite>
diff --git a/tests/auto/testlib/selftests/float/float.pro b/tests/auto/testlib/selftests/float/float.pro
new file mode 100644
index 0000000000..2c5ac3ebf7
--- /dev/null
+++ b/tests/auto/testlib/selftests/float/float.pro
@@ -0,0 +1,12 @@
+load(qttest_p4)
+
+# this is not a real testcase ('make check' should not run it)
+CONFIG -= testcase
+
+SOURCES += tst_float.cpp
+QT = core
+
+mac:CONFIG -= app_bundle
+CONFIG -= debug_and_release_target
+
+TARGET = float
diff --git a/tests/auto/testlib/selftests/float/tst_float.cpp b/tests/auto/testlib/selftests/float/tst_float.cpp
new file mode 100644
index 0000000000..65bd3188cb
--- /dev/null
+++ b/tests/auto/testlib/selftests/float/tst_float.cpp
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore>
+#include <QtTest/QtTest>
+#include <QDebug>
+
+class tst_float: public QObject
+{
+ Q_OBJECT
+private slots:
+ void floatComparisons() const;
+ void floatComparisons_data() const;
+ void compareFloatTests() const;
+ void compareFloatTests_data() const;
+};
+
+void tst_float::floatComparisons() const
+{
+ QFETCH(float, operandLeft);
+ QFETCH(float, operandRight);
+
+ QCOMPARE(operandLeft, operandRight);
+}
+
+void tst_float::floatComparisons_data() const
+{
+ QTest::addColumn<float>("operandLeft");
+ QTest::addColumn<float>("operandRight");
+
+ QTest::newRow("should SUCCEED")
+ << float(0)
+ << float(0);
+
+ QTest::newRow("should FAIL")
+ << float(1.00000)
+ << float(3.00000);
+
+ QTest::newRow("should FAIL")
+ << float(1.00000e-7f)
+ << float(3.00000e-7f);
+
+ QTest::newRow("should FAIL")
+ << float(100001)
+ << float(100002);
+}
+
+void tst_float::compareFloatTests() const
+{
+ QFETCH(float, t1);
+
+ // 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
+ const float t2 = t1 + (t1 / 1e6);
+ const float t3 = 3 * t1;
+
+ QCOMPARE(t1, t2);
+
+ /* Should FAIL. */
+ QCOMPARE(t1, t3);
+}
+
+void tst_float::compareFloatTests_data() const
+{
+ QTest::addColumn<float>("t1");
+ QTest::newRow("1e0") << 1e0f;
+ QTest::newRow("1e-7") << 1e-7f;
+ QTest::newRow("1e+7") << 1e+7f;
+}
+
+QTEST_MAIN(tst_float)
+
+#include "tst_float.moc"
diff --git a/tests/auto/testlib/selftests/selftests.pro b/tests/auto/testlib/selftests/selftests.pro
index 27a6d5d3f4..353e465961 100644
--- a/tests/auto/testlib/selftests/selftests.pro
+++ b/tests/auto/testlib/selftests/selftests.pro
@@ -5,7 +5,7 @@ SUBDIRS = subtest test warnings maxwarnings cmptest globaldata skipglobal skip \
skipinit skipinitdata datetime singleskip assert differentexec \
exceptionthrow qexecstringlist datatable commandlinedata\
benchlibwalltime benchlibcallgrind benchlibeventcounter benchlibtickcounter \
- benchliboptions xunit badxml longstring
+ benchliboptions xunit badxml longstring float
INSTALLS =
diff --git a/tests/auto/testlib/selftests/selftests.qrc b/tests/auto/testlib/selftests/selftests.qrc
index 77b4d213c0..41fa7e0763 100644
--- a/tests/auto/testlib/selftests/selftests.qrc
+++ b/tests/auto/testlib/selftests/selftests.qrc
@@ -73,6 +73,10 @@
<file>expected_fetchbogus.txt</file>
<file>expected_fetchbogus.xml</file>
<file>expected_fetchbogus.xunitxml</file>
+ <file>expected_float.lightxml</file>
+ <file>expected_float.txt</file>
+ <file>expected_float.xml</file>
+ <file>expected_float.xunitxml</file>
<file>expected_globaldata.lightxml</file>
<file>expected_globaldata.txt</file>
<file>expected_globaldata.xml</file>
diff --git a/tests/auto/testlib/selftests/subtest/tst_subtest.cpp b/tests/auto/testlib/selftests/subtest/tst_subtest.cpp
index 4404a5103f..7ccfc507d7 100644
--- a/tests/auto/testlib/selftests/subtest/tst_subtest.cpp
+++ b/tests/auto/testlib/selftests/subtest/tst_subtest.cpp
@@ -42,6 +42,7 @@
#include <QtCore>
#include <QtTest/QtTest>
+#include <QDebug>
class tst_Subtest: public QObject
{
@@ -59,53 +60,49 @@ private slots:
void test2();
void test3_data();
void test3();
- void floatComparisons() const;
- void floatComparisons_data() const;
- void compareFloatTests() const;
- void compareFloatTests_data() const;
};
void tst_Subtest::initTestCase()
{
- printf("initTestCase %s %s\n",
- QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)",
- QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
+ qDebug() << "initTestCase"
+ << (QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)")
+ << (QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
}
void tst_Subtest::cleanupTestCase()
{
- printf("cleanupTestCase %s %s\n",
- QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)",
- QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
+ qDebug() << "cleanupTestCase"
+ << (QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)")
+ << (QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
}
void tst_Subtest::init()
{
- printf("init %s %s\n",
- QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)",
- QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
+ qDebug() << "init"
+ << (QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)")
+ << (QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
}
void tst_Subtest::cleanup()
{
- printf("cleanup %s %s\n",
- QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)",
- QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
+ qDebug() << "cleanup"
+ << (QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)")
+ << (QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
}
void tst_Subtest::test1()
{
- printf("test1 %s %s\n",
- QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)",
- QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
+ qDebug() << "test1"
+ << (QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)")
+ << (QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
}
void tst_Subtest::test2_data()
{
- printf("test2_data %s %s\n",
- QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)",
- QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
+ qDebug() << "test2_data"
+ << (QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)")
+ << (QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
QTest::addColumn<QString>("str");
@@ -113,28 +110,28 @@ void tst_Subtest::test2_data()
QTest::newRow("data1") << QString("hello1");
QTest::newRow("data2") << QString("hello2");
- printf("test2_data end\n");
+ qDebug() << "test2_data end";
}
void tst_Subtest::test2()
{
- printf("test2 %s %s\n",
- QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)",
- QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
+ qDebug() << "test2"
+ << (QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)")
+ << (QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
static int count = 0;
QFETCH(QString, str);
QCOMPARE(str, QString("hello%1").arg(count++));
- printf("test2 end\n");
+ qDebug() << "test2 end";
}
void tst_Subtest::test3_data()
{
- printf("test3_data %s %s\n",
- QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)",
- QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
+ qDebug() << "test3_data"
+ << (QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)")
+ << (QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
QTest::addColumn<QString>("str");
@@ -142,76 +139,21 @@ void tst_Subtest::test3_data()
QTest::newRow("data1") << QString("hello1");
QTest::newRow("data2") << QString("hello2");
- printf("test3_data end\n");
+ qDebug() << "test3_data end";
}
void tst_Subtest::test3()
{
- printf("test2 %s %s\n",
- QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)",
- QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
+ qDebug() << "test2"
+ << (QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)")
+ << (QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
QFETCH(QString, str);
// second and third time we call this it should FAIL
QCOMPARE(str, QString("hello0"));
- printf("test2 end\n");
-}
-
-void tst_Subtest::floatComparisons() const
-{
- QFETCH(float, operandLeft);
- QFETCH(float, operandRight);
-
- QCOMPARE(operandLeft, operandRight);
-}
-
-void tst_Subtest::floatComparisons_data() const
-{
- QTest::addColumn<float>("operandLeft");
- QTest::addColumn<float>("operandRight");
-
- QTest::newRow("should SUCCEED")
- << float(0)
- << float(0);
-
- QTest::newRow("should FAIL")
- << float(1.00000)
- << float(3.00000);
-
- QTest::newRow("should FAIL")
- << float(1.00000e-7f)
- << float(3.00000e-7f);
-
- QTest::newRow("should FAIL")
- << float(100001)
- << float(100002);
-}
-
-void tst_Subtest::compareFloatTests() const
-{
- QFETCH(float, t1);
-
- // 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
- const float t2 = t1 + (t1 / 1e6);
- const float t3 = 3 * t1;
-
- QCOMPARE(t1, t2);
-
- /* Should FAIL. */
- QCOMPARE(t1, t3);
-}
-
-void tst_Subtest::compareFloatTests_data() const
-{
- QTest::addColumn<float>("t1");
- QTest::newRow("1e0") << 1e0f;
- QTest::newRow("1e-7") << 1e-7f;
- QTest::newRow("1e+7") << 1e+7f;
+ qDebug() << "test2 end";
}
QTEST_MAIN(tst_Subtest)
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index 9c9d281478..bd0594dbcf 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -189,6 +189,7 @@ void tst_Selftests::runSubTest_data()
<< "maxwarnings"
<< "cmptest"
// << "alive" // timer dependent
+ << "float"
<< "globaldata"
<< "skipglobal"
<< "skip"
@@ -287,7 +288,7 @@ void tst_Selftests::runSubTest_data()
}
// this test prints out some floats in the testlog and the formatting is
// platform-specific and hard to predict.
- if (subtest == "subtest") {
+ if (subtest == "float") {
continue;
}
}
@@ -417,7 +418,7 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QString const& logger, Q
if (expected.startsWith(QLatin1String("FAIL! : tst_Exception::throwException() Caught unhandled exce")) && expected != output)
// On some platforms we compile without RTTI, and as a result we never throw an exception.
QCOMPARE(output.simplified(), QString::fromLatin1("tst_Exception::throwException()").simplified());
- else if (output != expected && qstrcmp(QTest::currentDataTag(), "subtest") == 0)
+ else if (output != expected && qstrcmp(QTest::currentDataTag(), "float") == 0)
// The floating point formatting differs between platforms, so let's just skip it.
continue;
else if (benchmark || line.startsWith("<BenchmarkResult")) {