diff yetilab/vector/test/test_vector.yeti @ 276:39b5f3fed12d

Make slice return partial slices when range extents overlap vector ends
author Chris Cannam
date Sat, 25 May 2013 18:31:10 +0100
parents 197d23954a4e
children
line wrap: on
line diff
--- a/yetilab/vector/test/test_vector.yeti	Sat May 25 18:18:10 2013 +0100
+++ b/yetilab/vector/test/test_vector.yeti	Sat May 25 18:31:10 2013 +0100
@@ -78,9 +78,12 @@
 
 "slice": \(
     v = vec.fromList [1,2,3,4];
-    vec.equal (vec.slice v 0 4) v and (
-        vec.equal (vec.slice v 2 4) (vec.fromList [3,4])
-    )
+    vec.equal (vec.slice v 0 4) v and
+        vec.equal (vec.slice v 2 4) (vec.fromList [3,4]) and
+        vec.equal (vec.slice v (-1) 2) (vec.fromList [1,2]) and
+        vec.equal (vec.slice v 3 5) (vec.fromList [4]) and
+        vec.equal (vec.slice v 5 7) (vec.fromList []) and
+        vec.equal (vec.slice v 3 2) (vec.fromList [])
 ),
 
 "resizedTo": \(