changeset 172:f1c75782e56e

Further tests and fixes
author Chris Cannam
date Thu, 02 May 2013 17:36:43 +0100
parents df2383f6b99b
children 2cb4c78d42db
files yetilab/stream/filter.yeti yetilab/stream/test/test_filter.yeti
diffstat 2 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/yetilab/stream/filter.yeti	Thu May 02 17:33:55 2013 +0100
+++ b/yetilab/stream/filter.yeti	Thu May 02 17:36:43 2013 +0100
@@ -45,7 +45,7 @@
 //!!! not really mixed -- what's the word for it? one per channel
 mixed s1 s2 = //!!! could generalise to list of streams
     {
-        get position () = s1.position,
+        get position () = min s1.position s2.position, // can differ after EOS
         get channels () = s1.channels + s2.channels,
         get sampleRate () = s1.sampleRate,
         get available () = minDurationOf s1.available s2.available,
--- a/yetilab/stream/test/test_filter.yeti	Thu May 02 17:33:55 2013 +0100
+++ b/yetilab/stream/test/test_filter.yeti	Thu May 02 17:36:43 2013 +0100
@@ -29,10 +29,25 @@
         compare str.sampleRate 2 and
         compare str.available (Infinite ()) and
         compare str.finished? false and
-        compare (map bl.list (mat.asRows (str.read 4))) [[0,1,2,3], [0,-1,-2,-3]] and
+        compare (map bl.list (mat.asRows (str.read 4)))
+            [[0,0.5,1.0,1.5], [0,-0.5,-1,-1.5]] and
         compare str.available (Infinite ()) and
         compare str.position 4
 ),
 
+"mixed-inf-trunc": \(
+    str = filt.mixed (syn.generated 2 id) (filt.truncatedTo 3 (syn.generated 2 (0-)));
+    compare str.position 0 and
+        compare str.channels 2 and
+        compare str.sampleRate 2 and
+        compare str.available (Known 3) and
+        compare str.finished? false and
+        compare (map bl.list (mat.asRows (str.read 4)))
+            [[0,0.5,1.0], [0,-0.5,-1]] and
+        compare str.available (Known 0) and
+        compare str.finished? true and
+        compare str.position 3
+),
+
 ] is hash<string, () -> boolean>