comparison 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
comparison
equal deleted inserted replaced
1540:a53bf95f0bea 1541:71207822a7e0
135 135
136 QCOMPARE(RealTime::fromMilliseconds(-0), RealTime(0, 0)); 136 QCOMPARE(RealTime::fromMilliseconds(-0), RealTime(0, 0));
137 QCOMPARE(RealTime::fromMilliseconds(-500), RealTime(0, -ONE_BILLION/2)); 137 QCOMPARE(RealTime::fromMilliseconds(-500), RealTime(0, -ONE_BILLION/2));
138 QCOMPARE(RealTime::fromMilliseconds(-1000), RealTime(-1, 0)); 138 QCOMPARE(RealTime::fromMilliseconds(-1000), RealTime(-1, 0));
139 QCOMPARE(RealTime::fromMilliseconds(-1500), RealTime(-1, -ONE_BILLION/2)); 139 QCOMPARE(RealTime::fromMilliseconds(-1500), RealTime(-1, -ONE_BILLION/2));
140 }
141
142 void fromMicroseconds()
143 {
144 QCOMPARE(RealTime::fromMicroseconds(0), RealTime(0, 0));
145 QCOMPARE(RealTime::fromMicroseconds(500000), RealTime(0, ONE_BILLION/2));
146 QCOMPARE(RealTime::fromMicroseconds(1000000), RealTime(1, 0));
147 QCOMPARE(RealTime::fromMicroseconds(1500000), RealTime(1, ONE_BILLION/2));
148
149 QCOMPARE(RealTime::fromMicroseconds(-0), RealTime(0, 0));
150 QCOMPARE(RealTime::fromMicroseconds(-500000), RealTime(0, -ONE_BILLION/2));
151 QCOMPARE(RealTime::fromMicroseconds(-1000000), RealTime(-1, 0));
152 QCOMPARE(RealTime::fromMicroseconds(-1500000), RealTime(-1, -ONE_BILLION/2));
153 QCOMPARE(RealTime::fromMicroseconds(13500000), RealTime(13, ONE_BILLION/2));
140 } 154 }
141 155
142 void fromTimeval() 156 void fromTimeval()
143 { 157 {
144 struct timeval tv; 158 struct timeval tv;