Mercurial > hg > svcore
diff base/test/TestOurRealTime.h @ 1541:71207822a7e0 zoom
Provide fromMicroseconds (and test it)
author | Chris Cannam |
---|---|
date | Thu, 27 Sep 2018 15:53:34 +0100 |
parents | 622d193a00dc |
children |
line wrap: on
line diff
--- a/base/test/TestOurRealTime.h Thu Sep 27 15:19:39 2018 +0100 +++ b/base/test/TestOurRealTime.h Thu Sep 27 15:53:34 2018 +0100 @@ -138,6 +138,20 @@ QCOMPARE(RealTime::fromMilliseconds(-1000), RealTime(-1, 0)); QCOMPARE(RealTime::fromMilliseconds(-1500), RealTime(-1, -ONE_BILLION/2)); } + + void fromMicroseconds() + { + QCOMPARE(RealTime::fromMicroseconds(0), RealTime(0, 0)); + QCOMPARE(RealTime::fromMicroseconds(500000), RealTime(0, ONE_BILLION/2)); + QCOMPARE(RealTime::fromMicroseconds(1000000), RealTime(1, 0)); + QCOMPARE(RealTime::fromMicroseconds(1500000), RealTime(1, ONE_BILLION/2)); + + QCOMPARE(RealTime::fromMicroseconds(-0), RealTime(0, 0)); + QCOMPARE(RealTime::fromMicroseconds(-500000), RealTime(0, -ONE_BILLION/2)); + QCOMPARE(RealTime::fromMicroseconds(-1000000), RealTime(-1, 0)); + QCOMPARE(RealTime::fromMicroseconds(-1500000), RealTime(-1, -ONE_BILLION/2)); + QCOMPARE(RealTime::fromMicroseconds(13500000), RealTime(13, ONE_BILLION/2)); + } void fromTimeval() {