diff +blockmatrix/isDivisionTest.m @ 203:764438b52541 feature/grids

blockmatrix: Added functions to test for block matrcies and divisions.
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 15 Jun 2016 14:29:56 +0200
parents
children a5f1b0267dba
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/+blockmatrix/isDivisionTest.m	Wed Jun 15 14:29:56 2016 +0200
@@ -0,0 +1,23 @@
+function tests = isDivisionTest()
+    tests = functiontests(localfunctions);
+end
+
+function testIsDivision(testCase)
+    cases = {
+        {{[2 2 2],[1 2]} ,true},
+        {{[1 2],[1 0]} ,false},
+        {{[0 2],[1 1]} ,false},
+        {{[1 2],[]} ,false},
+        {{[1 2],[1]} ,true},
+        {{[1 2],[1], [1 2 3]} ,false},
+        {{[1 2 3]} ,false},
+        {[1 2] ,false},
+    };
+
+    for i = 1:length(cases)
+        in = cases{i}{1};
+        out = blockmatrix.isDivision(in);
+        expected = cases{i}{2};
+        testCase.verifyEqual(out, expected, sprintf('Should return %d for %s', expected, toString(in)));
+    end
+end
\ No newline at end of file