Mercurial > repos > public > sbplib
comparison +blockmatrix/getDivisionTest.m @ 427:a613960a157b feature/quantumTriangles
merged with feature/beams
| author | Ylva Rydin <ylva.rydin@telia.com> |
|---|---|
| date | Thu, 26 Jan 2017 15:59:25 +0100 |
| parents | f0ef314e2070 |
| children | a5f1b0267dba |
comparison
equal
deleted
inserted
replaced
| 426:29944ea7674b | 427:a613960a157b |
|---|---|
| 1 function tests = getDivisionTest() | |
| 2 tests = functiontests(localfunctions); | |
| 3 end | |
| 4 | |
| 5 function testError(testCase) | |
| 6 cases = { | |
| 7 magic(3), | |
| 8 {[2 2 2];{1,2}}, | |
| 9 {[2 2 2];[1 2]}, | |
| 10 {[2; 2; 2], [1; 2]}, | |
| 11 }; | |
| 12 | |
| 13 for i =1:length(cases) | |
| 14 testCase.verifyError(@()blockmatrix.getDivision(cases{i}), 'blockmatrix:getDivision:NotABlockmatrix') | |
| 15 end | |
| 16 end | |
| 17 | |
| 18 function testGetDivision(testCase) | |
| 19 cases = { | |
| 20 { | |
| 21 {}, | |
| 22 {[],[]}; | |
| 23 }, | |
| 24 { | |
| 25 { | |
| 26 [2 2; 2 1], [1; 2]; | |
| 27 [2 2], [1] | |
| 28 }, | |
| 29 {[2 1], [2 1]} | |
| 30 }, | |
| 31 { | |
| 32 { | |
| 33 [2 2; 2 1], []; | |
| 34 [2 2], [1] | |
| 35 }, | |
| 36 {[2 1], [2 1]} | |
| 37 }, | |
| 38 { | |
| 39 { | |
| 40 [2 2; 2 1], []; | |
| 41 [2 2], [] | |
| 42 }, | |
| 43 {[2 1], [2 0]} | |
| 44 }, | |
| 45 { | |
| 46 { | |
| 47 [2 2; 2 1], [1; 2]; | |
| 48 [], [] | |
| 49 }, | |
| 50 {[2 0], [2 1]} | |
| 51 }, | |
| 52 { | |
| 53 { | |
| 54 [2 2; 2 1]; | |
| 55 [2 2] | |
| 56 }, | |
| 57 {[2 1], 2} | |
| 58 }, | |
| 59 }; | |
| 60 | |
| 61 for i = 1:length(cases) | |
| 62 in = cases{i}{1}; | |
| 63 out = blockmatrix.getDivision(in); | |
| 64 expected = cases{i}{2}; | |
| 65 testCase.verifyEqual(out, expected); | |
| 66 end | |
| 67 end | |
| 68 | |
| 69 |
