Mercurial > hg > svcore
diff base/test/TestOurRealTime.h @ 1427:622d193a00dc
Rework canonicalisation so as to avoid theoretical possibility of integer overflow
author | Chris Cannam |
---|---|
date | Mon, 11 Dec 2017 09:28:40 +0000 |
parents | 980afe3f1a76 |
children | 71207822a7e0 |
line wrap: on
line diff
--- a/base/test/TestOurRealTime.h Thu Dec 07 13:33:30 2017 +0000 +++ b/base/test/TestOurRealTime.h Mon Dec 11 09:28:40 2017 +0000 @@ -70,6 +70,11 @@ QCOMPARE(RealTime(-2, ONE_BILLION*2), RealTime(0, 0)); QCOMPARE(RealTime(-2, ONE_BILLION/2), RealTime(-1, -ONE_BILLION/2)); + + QCOMPARE(RealTime(1, -ONE_BILLION/2).sec, 0); + QCOMPARE(RealTime(1, -ONE_BILLION/2).nsec, ONE_BILLION/2); + QCOMPARE(RealTime(-1, ONE_BILLION/2).sec, 0); + QCOMPARE(RealTime(-1, ONE_BILLION/2).nsec, -ONE_BILLION/2); QCOMPARE(RealTime(0, 1).sec, 0); QCOMPARE(RealTime(0, 1).nsec, 1);