Mercurial > hg > svcore
comparison base/test/TestOurRealTime.h @ 1263:abfc498c52bc 3.0-integration
Test fixes
author | Chris Cannam |
---|---|
date | Tue, 15 Nov 2016 16:54:02 +0000 |
parents | c4f873749ab5 |
children | b7b84ae5f0a7 |
comparison
equal
deleted
inserted
replaced
1262:c4f873749ab5 | 1263:abfc498c52bc |
---|---|
322 for (int i = 0; i < n; ++i) { | 322 for (int i = 0; i < n; ++i) { |
323 frame_type frame = frames[i]; | 323 frame_type frame = frames[i]; |
324 for (int j = 0; j < m; ++j) { | 324 for (int j = 0; j < m; ++j) { |
325 int rate = rates[j]; | 325 int rate = rates[j]; |
326 | 326 |
327 cerr << "frame = " << frame << ", rate = " << rate << endl; | |
328 | |
329 RealTime rt = RealTime::frame2RealTime(frame, rate); | 327 RealTime rt = RealTime::frame2RealTime(frame, rate); |
330 QCOMPARE(rt.sec, realTimes[j][i].sec); | 328 QCOMPARE(rt.sec, realTimes[j][i].sec); |
331 QCOMPARE(rt.nsec, realTimes[j][i].nsec); | 329 QCOMPARE(rt.nsec, realTimes[j][i].nsec); |
332 | 330 |
333 cerr << "rt = " << rt << endl; | |
334 cerr << "rate = " << rate << endl; | |
335 | |
336 frame_type conv = RealTime::realTime2Frame(rt, rate); | 331 frame_type conv = RealTime::realTime2Frame(rt, rate); |
337 cerr << "conv = " << conv << endl; | |
338 | 332 |
339 rt = RealTime::frame2RealTime(-frame, rate); | 333 rt = RealTime::frame2RealTime(-frame, rate); |
340 frame_type negconv = RealTime::realTime2Frame(rt, rate); | 334 frame_type negconv = RealTime::realTime2Frame(rt, rate); |
341 cerr << "negconv = " << negconv << endl; | |
342 | 335 |
343 if (rate > ONE_BILLION) { | 336 if (rate > ONE_BILLION) { |
344 // We no longer have enough precision in RealTime | 337 // We don't have enough precision in RealTime |
345 // for this absurd sample rate, so a round trip | 338 // for this absurd sample rate, so a round trip |
346 // conversion may round | 339 // conversion may round |
347 QVERIFY(abs(frame - conv) < 2); | 340 QVERIFY(abs(frame - conv) < 2); |
348 QVERIFY(abs(-frame - negconv) < 2); | 341 QVERIFY(abs(-frame - negconv) < 2); |
349 } else { | 342 } else { |