changeset 278:704c58ab4598

Fixes to duplicate
author Chris Cannam
date Sat, 25 May 2013 18:42:01 +0100
parents 678477bf617c
children 3aacfde637fd
files yetilab/stream/filter.yeti yetilab/stream/test/test_filter.yeti
diffstat 2 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/yetilab/stream/filter.yeti	Sat May 25 18:41:53 2013 +0100
+++ b/yetilab/stream/filter.yeti	Sat May 25 18:42:01 2013 +0100
@@ -217,8 +217,7 @@
             pos[i] := pos[i] + n;
             encroachment = lowtide () - formerLow;
             if encroachment > 0 then
-                cache := mat.columnSlice cache encroachment
-                   (mat.width cache - encroachment);
+                cache := mat.columnSlice cache encroachment (mat.width cache);
             fi);
         map do instance:
             pos[instance] := 0;
@@ -242,11 +241,11 @@
                     else
                         if count > ready then
                             more = s.read (count - ready);
-                            cache := mat.concat (Horizontal ())
-                               [cache, more];
+                            cache := mat.concat (Horizontal ()) [cache, more];
+                            hightide := hightide + (mat.width more);
                         fi;
-                        chunk = mat.columnSlice cache
-                           (pos[instance] - (lowtide ())) count;
+                        offset = pos[instance] - (lowtide ());
+                        chunk = mat.columnSlice cache offset (offset + count);
                         advance instance (mat.width chunk);
                         chunk;
                     fi),
--- a/yetilab/stream/test/test_filter.yeti	Sat May 25 18:41:53 2013 +0100
+++ b/yetilab/stream/test/test_filter.yeti	Sat May 25 18:42:01 2013 +0100
@@ -518,7 +518,7 @@
         compare s1.available (Known 0) and
         compare s2.position 2 and
         compare s2.finished? false and
-        compare s2.available (maybeKnown 1) and
+        compare s2.available (Known 1) and // when one is known, so is the other
 
         compare (map vec.list (mat.asRows (s1.read 3))) [] and