changeset 1259:a4554bf41367 3.0-integration

Further RealTime test (currently failing)
author Chris Cannam
date Mon, 14 Nov 2016 15:00:29 +0000 (2016-11-14)
parents 200c60de27ca
children 24c0d4c5356e
files base/test/TestRealTime.h
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/base/test/TestRealTime.h	Thu Nov 10 09:58:28 2016 +0000
+++ b/base/test/TestRealTime.h	Mon Nov 14 15:00:29 2016 +0000
@@ -276,7 +276,8 @@
     void frame()
     {
         int frames[] = {
-            0, 1, 2047, 2048, 6656, 32767, 32768, 44100, 44101, 999999999
+            0, 1, 2047, 2048, 6656,
+            32767, 32768, 44100, 44101, 999999999
         };
         int n = sizeof(frames)/sizeof(frames[0]);
 
@@ -285,12 +286,25 @@
         };
         int m = sizeof(rates)/sizeof(rates[0]);
 
+        vector<vector<RealTime>> realTimes = {
+            { { 0, 0 }, { 1, 0 }, { 2047, 0 }, { 2048, 0 }, { 6656, 0 }, { 32767, 0 }, { 32768, 0 }, { 44100, 0 }, { 44101, 0 }, { 999999999, 0 } },
+            { { 0, 0 }, { 0, 500000000 }, { 1023, 500000000 }, { 1024, 0 }, { 3328, 0 }, { 16383, 500000000 }, { 16384, 0 }, { 22050, 0 }, { 22050, 500000000 }, { 499999999, 500000000 } },
+            { { 0, 0 }, { 0, 125000 }, { 0, 255875000 }, { 0, 256000000 }, { 0, 832000000 }, { 4, 95875000 }, { 4, 96000000 }, { 5, 512500000 }, { 5, 512625000 }, { 124999, 999875000 } },
+            { { 0, 0 }, { 0, 45351 }, { 0, 92834467 }, { 0, 92879819 }, { 0, 301859410 }, { 1, 486031746 }, { 1, 486077098 }, { 2, 0 }, { 2, 45351 }, { 45351, 473877551 } },
+            { { 0, 0 }, { 0, 22676 }, { 0, 46417234 }, { 0, 46439909 }, { 0, 150929705 }, { 0, 743015873 }, { 0, 743038549 }, { 1, 0 }, { 1, 22676 }, { 22675, 736938776 } },
+            { { 0, 0 }, { 0, 22675 }, { 0, 46416181 }, { 0, 46438856 }, { 0, 150926283 }, { 0, 742999025 }, { 0, 743021700 }, { 0, 999977325 }, { 1, 0 }, { 22675, 222761389 } },
+            { { 0, 0 }, { 0, 5208 }, { 0, 10661458 }, { 0, 10666667 }, { 0, 34666667 }, { 0, 170661458 }, { 0, 170666667 }, { 0, 229687500 }, { 0, 229692708 }, { 5208, 333328125 } },
+        };
+        
         for (int i = 0; i < n; ++i) {
             sv_frame_t frame = frames[i];
             for (int j = 0; j < m; ++j) {
                 int rate = rates[j];
 
                 RealTime rt = RealTime::frame2RealTime(frame, rate);
+                QCOMPARE(rt.sec, realTimes[j][i].sec);
+                QCOMPARE(rt.nsec, realTimes[j][i].nsec);
+
                 sv_frame_t conv = RealTime::realTime2Frame(rt, rate);
                 QCOMPARE(frame, conv);