comparison base/test/TestVampRealTime.h @ 1263:abfc498c52bc 3.0-integration

Test fixes
author Chris Cannam
date Tue, 15 Nov 2016 16:54:02 +0000
parents c4f873749ab5
children 980afe3f1a76
comparison
equal deleted inserted replaced
1262:c4f873749ab5 1263:abfc498c52bc
296 for (int i = 0; i < n; ++i) { 296 for (int i = 0; i < n; ++i) {
297 frame_type frame = frames[i]; 297 frame_type frame = frames[i];
298 for (int j = 0; j < m; ++j) { 298 for (int j = 0; j < m; ++j) {
299 int rate = rates[j]; 299 int rate = rates[j];
300 300
301 cerr << "frame = " << frame << ", rate = " << rate << endl;
302
303 RealTime rt = RealTime::frame2RealTime(frame, rate); 301 RealTime rt = RealTime::frame2RealTime(frame, rate);
304 QCOMPARE(rt.sec, realTimes[j][i].sec); 302 QCOMPARE(rt.sec, realTimes[j][i].sec);
305 QCOMPARE(rt.nsec, realTimes[j][i].nsec); 303 QCOMPARE(rt.nsec, realTimes[j][i].nsec);
306 304
307 cerr << "rt = " << rt << endl;
308 cerr << "rate = " << rate << endl;
309
310 frame_type conv = RealTime::realTime2Frame(rt, rate); 305 frame_type conv = RealTime::realTime2Frame(rt, rate);
311 cerr << "conv = " << conv << endl;
312 306
313 rt = RealTime::frame2RealTime(-frame, rate); 307 rt = RealTime::frame2RealTime(-frame, rate);
314 frame_type negconv = RealTime::realTime2Frame(rt, rate); 308 frame_type negconv = RealTime::realTime2Frame(rt, rate);
315 cerr << "negconv = " << negconv << endl;
316 309
317 if (rate > ONE_BILLION) { 310 if (rate > ONE_BILLION) {
318 // We no longer have enough precision in RealTime 311 // We don't have enough precision in RealTime
319 // for this absurd sample rate, so a round trip 312 // for this absurd sample rate, so a round trip
320 // conversion may round 313 // conversion may round
321 QVERIFY(abs(frame - conv) < 2); 314 QVERIFY(abs(frame - conv) < 2);
322 QVERIFY(abs(-frame - negconv) < 2); 315 QVERIFY(abs(-frame - negconv) < 2);
323 } else { 316 } else {