diff yetilab/matrix/test/test_matrix.yeti @ 159:a9d58d9c71ca

Fix matrix.equal (did not check matrix size, could return true if one was a subset of the other) and add test for it; fix resizedTo test
author Chris Cannam
date Wed, 01 May 2013 12:32:08 +0100
parents b6db07468ed1
children 38938ca5db0c
line wrap: on
line diff
--- a/yetilab/matrix/test/test_matrix.yeti	Wed May 01 12:03:45 2013 +0100
+++ b/yetilab/matrix/test/test_matrix.yeti	Wed May 01 12:32:08 2013 +0100
@@ -91,10 +91,12 @@
     n = m;
     p = newMatrix (RowMajor ()) [[1,2,3],[4,5,6]];
     q = newMatrix (ColumnMajor ()) [[1,2,3],[4,5,6]];
+    r = newMatrix (ColumnMajor ()) [[1,4],[2,5]];
     compareMatrices m n and
         compareMatrices m p and
         compareMatrices n p and
-        not mat.equal m q
+        not mat.equal m q and
+        not mat.equal m r
 ),
 
 "getAt-\(name)": \(
@@ -227,7 +229,7 @@
     compareMatrices
        (mat.resizedTo { rows = 2, columns = 2 }
            (newMatrix (ColumnMajor ()) [[1,4],[2,5],[3,6]]))
-       (newMatrix (ColumnMajor ()) [[1,4],[2,5],[3,6]]) and
+       (newMatrix (ColumnMajor ()) [[1,4],[2,5]]) and
         compareMatrices
            (mat.resizedTo { rows = 3, columns = 4 }
                (newMatrix (ColumnMajor ()) [[1,4],[2,5],[3,6]]))
@@ -235,7 +237,7 @@
         compareMatrices
            (mat.resizedTo { rows = 1, columns = 1 }
                (newMatrix (ColumnMajor ()) [[1,4],[2,5],[3,6]]))
-           (newMatrix (ColumnMajor ()) [[1]])
+           (newMatrix (RowMajor ()) [[1]])
 ),
 
 "zeroSizeMatrix-\(name)": \(