comparison +blockmatrix/isDivisionTest.m @ 579:a5f1b0267dba feature/grids

Be less strict about what is considered a block matrix Empty blocks of different sizes are now allowed as well as empty block dimensions
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 07 Sep 2017 09:21:04 +0200
parents 764438b52541
children
comparison
equal deleted inserted replaced
578:1fe16b34f114 579:a5f1b0267dba
2 tests = functiontests(localfunctions); 2 tests = functiontests(localfunctions);
3 end 3 end
4 4
5 function testIsDivision(testCase) 5 function testIsDivision(testCase)
6 cases = { 6 cases = {
7 {[1 2] ,false}, % Must be a cell array
8 {{[1 2 3]} ,false}, % Must have two vectors
9 {{[],[]}, true} % No blocks is a valid blockmatrix
10 {{[1 2],[]} ,true},
11 {{[],[1 2]} ,true},
7 {{[2 2 2],[1 2]} ,true}, 12 {{[2 2 2],[1 2]} ,true},
8 {{[1 2],[1 0]} ,false}, 13 {{[1 2],[1 0]} ,true},
9 {{[0 2],[1 1]} ,false}, 14 {{[0 2],[1 1]} ,true},
10 {{[1 2],[]} ,false},
11 {{[1 2],[1]} ,true}, 15 {{[1 2],[1]} ,true},
12 {{[1 2],[1], [1 2 3]} ,false}, 16 {{[1 2],[1], [1 2 3]} ,false},
13 {{[1 2 3]} ,false},
14 {[1 2] ,false},
15 }; 17 };
16 18
17 for i = 1:length(cases) 19 for i = 1:length(cases)
18 in = cases{i}{1}; 20 in = cases{i}{1};
19 out = blockmatrix.isDivision(in); 21 out = blockmatrix.isDivision(in);