changeset 365:de59b3504455

Test for picked
author Chris Cannam
date Fri, 12 Jul 2013 10:38:42 +0100
parents 99103233707a
children bbc93e52dd5c
files may/stream/test/test_filter.yeti
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/may/stream/test/test_filter.yeti	Fri Jul 12 10:33:43 2013 +0100
+++ b/may/stream/test/test_filter.yeti	Fri Jul 12 10:38:42 2013 +0100
@@ -644,6 +644,25 @@
         ( str.close (); true )
 ),
 
+"picked-\(name)": \(
+    original = maybeDuration 8 (syn.precalculatedMono 2 (vec.fromList [1,2,3,4,5,6,7,8]));
+    str = filt.picked 3 original;
+    compare str.position 0 and
+        compare str.channels 1 and
+        compare str.sampleRate 2 and
+        compare str.available (maybeKnown 3) and
+        compare str.finished? false and
+        compare (map vec.list (mat.asRows (str.read 1))) [[1]] and
+        compare str.position 1 and
+        compare str.available (maybeKnown 2) and
+        compare str.finished? false and
+        compare (map vec.list (mat.asRows (str.read 3))) [[4,7]] and
+        compare str.position 3 and
+        compare str.available (Known 0) and
+        compare str.finished? true and
+        ( str.close (); true )
+),
+
 "interpolated-sine-\(name)": \(
     // Interpolating a sinusoid should give us a sinusoid
     sinusoid = syn.sinusoid 8 2; // 2Hz sine sampled at 8Hz: [ 0, 1, 0, -1 ] etc