changeset 88:a52cb6cd7a02

Use the same test data for all three tests
author Chris Cannam
date Mon, 18 Mar 2013 10:06:35 +0000
parents bf48110c0efa
children ef650ce77237
files test/test_vamppost.yeti
diffstat 1 files changed, 19 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/test/test_vamppost.yeti	Mon Mar 18 10:03:47 2013 +0000
+++ b/test/test_vamppost.yeti	Mon Mar 18 10:06:35 2013 +0000
@@ -7,6 +7,18 @@
 untimed n = { timestamp = Untimed (), values = [n] };
 timed t n = { timestamp = Time t, values = [n] };
 
+testdata =  {
+    output = { sampleType = OneSamplePerStep () },
+    config = { sampleRate = 1000, stepSize = 100 },
+    features = [
+        [],
+        [ untimed 1 ],
+        [ untimed 1, untimed 2 ],
+        [],
+        [ timed 1.1 1, untimed 2, timed 4 3 ]
+    ]
+};
+
 [
 
 "fillOneSamplePerStep": \(
@@ -14,17 +26,8 @@
     // a single sub-list of the feature list) should be given the same
     // timestamp; the timestamp increments according to the config
     // step size between sub-lists
-    filled = vp.fillTimestamps {
-        output = { sampleType = OneSamplePerStep () },
-        config = { sampleRate = 1000, stepSize = 100 },
-        features = [
-            [],
-            [ untimed 1 ],
-            [ untimed 1, untimed 2 ],
-            [],
-            [ timed 1 1, untimed 2, timed 4 3 ]
-        ]
-    };
+    filled = vp.fillTimestamps
+       (testdata with { output = { sampleType = OneSamplePerStep () } });
     compare filled [
         timed 0.1 1 ,
         timed 0.2 1, timed 0.2 2 ,
@@ -42,17 +45,8 @@
     // the [output descriptor's] sample rate". Note that the time is
     // based on that of the previous feature, not that of the previous
     // process cycle (as is the case with OneSamplePerStep features).
-    filled = vp.fillTimestamps {
-        output = { sampleType = FixedSampleRate 5 },
-        config = { sampleRate = 1000, stepSize = 100 },
-        features = [
-            [],
-            [ untimed 1 ],
-            [ untimed 1, untimed 2 ],
-            [],
-            [ timed 1.1 1, untimed 2, timed 4 3 ]
-        ]
-    };
+    filled = vp.fillTimestamps
+       (testdata with { output = { sampleType = FixedSampleRate 5 } });
     compare filled [
         timed 0 1 ,
         timed 0.2 1, timed 0.4 2 ,
@@ -65,21 +59,12 @@
     // be left entirely alone by fillTimestamps -- it's an error for
     // the plugin to return any features without valid timestamps,
     // but it isn't the job of fillTimestamps to handle that error
-    filled = vp.fillTimestamps {
-        output = { sampleType = VariableSampleRate 5 },
-        config = { sampleRate = 1000, stepSize = 100 },
-        features = [
-            [],
-            [ untimed 1 ],
-            [ untimed 1, untimed 2 ],
-            [],
-            [ timed 1 1, untimed 2, timed 4 3 ]
-        ]
-    };
+    filled = vp.fillTimestamps
+       (testdata with { output = { sampleType = VariableSampleRate 5 } });
     compare filled [
         untimed 1 ,
         untimed 1, untimed 2 ,
-        timed 1.0 1, untimed 2, timed 4.0 3
+        timed 1.1 1, untimed 2, timed 4.0 3
     ];
 ),