summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-03-18 23:25:15 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-03-18 23:25:28 (GMT)
commit109a8a7a06831288ba1110f8caaaf6e5dee8bfbd (patch)
tree2a257c01206bc314bfc91b1ba7973bb4e14b6716
parent390554b120d8bdcffaa090e0a998a4fddfd4e282 (diff)
downloadQt-109a8a7a06831288ba1110f8caaaf6e5dee8bfbd.zip
Qt-109a8a7a06831288ba1110f8caaaf6e5dee8bfbd.tar.gz
Qt-109a8a7a06831288ba1110f8caaaf6e5dee8bfbd.tar.bz2
Autotest: fix instability by accepting rounding errors
-rw-r--r--tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp b/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp
index 912226d..9ea422c 100644
--- a/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp
+++ b/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp
@@ -111,9 +111,14 @@ void tst_QElapsedTimer::basics()
quint64 value1 = t1.msecsSinceReference();
qint64 elapsed = t1.restart();
- quint64 value2 = t1.msecsSinceReference();
- QCOMPARE(elapsed, qint64(value2 - value1));
QVERIFY(elapsed < minResolution);
+
+ quint64 value2 = t1.msecsSinceReference();
+ // in theory, elapsed == value2 - value1
+
+ // However, since QElapsedTimer keeps internally the full resolution,
+ // we have here a rounding error due to integer division
+ QVERIFY(qAbs(elapsed - qint64(value2 - value1)) < 1);
}
void tst_QElapsedTimer::elapsed()