diff +blockmatrix/isDivisionTest.m @ 886:8894e9c49e40 feature/timesteppers

Merge with default for latest changes
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Thu, 15 Nov 2018 16:36:21 -0800
parents a5f1b0267dba
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/+blockmatrix/isDivisionTest.m	Thu Nov 15 16:36:21 2018 -0800
@@ -0,0 +1,25 @@
+function tests = isDivisionTest()
+    tests = functiontests(localfunctions);
+end
+
+function testIsDivision(testCase)
+    cases = {
+        {[1 2] ,false},     % Must be a cell array
+        {{[1 2 3]} ,false}, % Must have two vectors
+        {{[],[]}, true}     % No blocks is a valid blockmatrix
+        {{[1 2],[]} ,true},
+        {{[],[1 2]} ,true},
+        {{[2 2 2],[1 2]} ,true},
+        {{[1 2],[1 0]} ,true},
+        {{[0 2],[1 1]} ,true},
+        {{[1 2],[1]} ,true},
+        {{[1 2],[1], [1 2 3]} ,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