diff yetilab/matrix/test/test_matrix.yeti @ 210:3a2be6eb8bd3 matrix_opaque_immutable

Finish matrix api conversion compile fixes
author Chris Cannam
date Wed, 08 May 2013 21:10:29 +0100
parents 9bc6070c041c
children 26111c11d8e4
line wrap: on
line diff
--- a/yetilab/matrix/test/test_matrix.yeti	Wed May 08 20:48:57 2013 +0100
+++ b/yetilab/matrix/test/test_matrix.yeti	Wed May 08 21:10:29 2013 +0100
@@ -21,69 +21,69 @@
 
 "constMatrixEmpty-\(name)": \(
     m = constMatrix 2 { rows = 0, columns = 0 };
-    compare m.size { columns = 0, rows = 0 }
+    compare (mat.size m) { columns = 0, rows = 0 }
 ),
 
 "constMatrixEmpty2-\(name)": \(
-    compare (constMatrix 2 { rows = 0, columns = 4 }).size { columns = 0, rows = 0 } and
-        compare (constMatrix 2 { rows = 4, columns = 0 }).size { columns = 0, rows = 0 }
+    compare (mat.size (constMatrix 2 { rows = 0, columns = 4 })) { columns = 0, rows = 0 } and
+        compare (mat.size (constMatrix 2 { rows = 4, columns = 0 })) { columns = 0, rows = 0 }
 ),
 
 "constMatrix-\(name)": \(
     m = constMatrix 2 { rows = 3, columns = 4 };
-    compare m.size { columns = 4, rows = 3 } and
-        all id (map do row: compare (block.list (m.getRow row)) [2,2,2,2] done [0..2]) and
-        all id (map do col: compare (block.list (m.getColumn col)) [2,2,2] done [0..3])
+    compare (mat.size m) { columns = 4, rows = 3 } and
+        all id (map do row: compare (block.list (mat.getRow row m)) [2,2,2,2] done [0..2]) and
+        all id (map do col: compare (block.list (mat.getColumn col m)) [2,2,2] done [0..3])
 ),
 
 "randomMatrixEmpty-\(name)": \(
     m = randomMatrix { rows = 0, columns = 0 };
-    compare m.size { columns = 0, rows = 0 }
+    compare (mat.size m) { columns = 0, rows = 0 }
 ),
 
 "randomMatrix-\(name)": \(
     m = randomMatrix { rows = 3, columns = 4 };
-    compare m.size { columns = 4, rows = 3 }
+    compare (mat.size m) { columns = 4, rows = 3 }
 ),
 
 "zeroMatrixEmpty-\(name)": \(
     m = zeroMatrix { rows = 0, columns = 0 };
-    compare m.size { columns = 0, rows = 0 }
+    compare (mat.size m) { columns = 0, rows = 0 }
 ),
 
 "zeroMatrix-\(name)": \(
     m = zeroMatrix { rows = 3, columns = 4 };
-    compare m.size { columns = 4, rows = 3 } and
-        all id (map do row: compare (block.list (m.getRow row)) [0,0,0,0] done [0..2]) and
-        all id (map do col: compare (block.list (m.getColumn col)) [0,0,0] done [0..3])
+    compare (mat.size m) { columns = 4, rows = 3 } and
+        all id (map do row: compare (block.list (mat.getRow row m)) [0,0,0,0] done [0..2]) and
+        all id (map do col: compare (block.list (mat.getColumn col m)) [0,0,0] done [0..3])
 ),
 
 "identityMatrixEmpty-\(name)": \(
     m = identityMatrix { rows = 0, columns = 0 };
-    compare m.size { columns = 0, rows = 0 }
+    compare (mat.size m) { columns = 0, rows = 0 }
 ),
 
 "identityMatrix-\(name)": \(
     m = identityMatrix { rows = 3, columns = 4 };
-    compare m.size { columns = 4, rows = 3 } and
-        all id (map do row: compare (block.list (m.getRow row)) [1,1,1,1] done [0..2]) and
-        all id (map do col: compare (block.list (m.getColumn col)) [1,1,1] done [0..3])
+    compare (mat.size m) { columns = 4, rows = 3 } and
+        all id (map do row: compare (block.list (mat.getRow row m)) [1,1,1,1] done [0..2]) and
+        all id (map do col: compare (block.list (mat.getColumn col m)) [1,1,1] done [0..3])
 ),
 
 "generateEmpty-\(name)": \(
     m = generate do row col: 0 done { rows = 0, columns = 0 };
-    compare m.size { columns = 0, rows = 0 }
+    compare (mat.size m) { columns = 0, rows = 0 }
 ),
 
 "generate-\(name)": \(
     m = generate do row col: row * 10 + col done { rows = 2, columns = 3 };
-    compare (block.list (m.getRow 0)) [0,1,2] and
-        compare (block.list (m.getRow 1)) [10,11,12]
+    compare (block.list (mat.getRow 0 m)) [0,1,2] and
+        compare (block.list (mat.getRow 1 m)) [10,11,12]
 ),
 
 "widthAndHeight-\(name)": \(
     m = constMatrix 2 { rows = 3, columns = 4 };
-    compare m.size { columns = mat.width m, rows = mat.height m }
+    compare (mat.size m) { columns = mat.width m, rows = mat.height m }
 ),
 
 "equal-\(name)": \(
@@ -104,17 +104,17 @@
     m = generate generator { rows = 2, columns = 3 };
     all id
        (map do row: all id
-           (map do col: m.getAt row col == generator row col done [0..2])
+           (map do col: mat.getAt row col m == generator row col done [0..2])
             done [0..1])
 ),
 
 "setAt-\(name)": \(
     generator row col = row * 10 + col;
     m = generate generator { rows = 2, columns = 3 };
-    m.setAt 1 2 16;
-    compare (m.getAt 1 2) 16 and
-        compare (m.getAt 1 1) 11 and
-        compare (m.getAt 0 2) 2
+    mat.setAt 1 2 16 m;
+    compare (mat.getAt 1 2 m) 16 and
+        compare (mat.getAt 1 1 m) 11 and
+        compare (mat.getAt 0 2 m) 2
 ),
 
 "copyOfEqual-\(name)": \(
@@ -127,18 +127,18 @@
     m = constMatrix 2 { rows = 3, columns = 4 };
     m' = m;
     m'' = mat.copyOf m;
-    m.setAt 0 0 6;
+    mat.setAt 0 0 6 m;
     compareMatrices m' m and not mat.equal m m'';
 ),
 
 "transposedEmpty-\(name)": \(
-    compare (mat.transposed (constMatrix 2 { rows = 0, columns = 0 })).size { columns = 0, rows = 0 } and
-        compare (mat.transposed (constMatrix 2 { rows = 0, columns = 4 })).size { columns = 0, rows = 0 } and
-        compare (mat.transposed (constMatrix 2 { rows = 4, columns = 0 })).size { columns = 0, rows = 0 }
+    compare (mat.size (mat.transposed (constMatrix 2 { rows = 0, columns = 0 }))) { columns = 0, rows = 0 } and
+        compare (mat.size (mat.transposed (constMatrix 2 { rows = 0, columns = 4 }))) { columns = 0, rows = 0 } and
+        compare (mat.size (mat.transposed (constMatrix 2 { rows = 4, columns = 0 }))) { columns = 0, rows = 0 }
 ),
 
 "transposedSize-\(name)": \(
-    compare (mat.transposed (constMatrix 2 { rows = 3, columns = 4 })).size { columns = 3, rows = 4 }
+    compare (mat.size (mat.transposed (constMatrix 2 { rows = 3, columns = 4 }))) { columns = 3, rows = 4 }
 ),
 
 "transposed-\(name)": \(
@@ -148,7 +148,7 @@
     all id
        (map do row: all id
            // like getAt test, but with col/row flipped
-           (map do col: m'.getAt col row == generator row col done [0..2])
+           (map do col: mat.getAt col row m' == generator row col done [0..2])
             done [0..1])
 ),