Mercurial > repos > public > sbplib
changeset 477:97c505c87f56 feature/sublassable_cellarray
Implement tests for size, length and transpose
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 02 Aug 2017 10:31:48 +0200 |
parents | 949ffe238f61 |
children | d91f27460741 |
files | CellTest.m |
diffstat | 1 files changed, 30 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
diff -r 949ffe238f61 -r 97c505c87f56 CellTest.m --- a/CellTest.m Wed Aug 02 10:22:20 2017 +0200 +++ b/CellTest.m Wed Aug 02 10:31:48 2017 +0200 @@ -3,15 +3,42 @@ end function testSize(testCase) - testCase.verifyFail(); + cases = { + {{}, [0, 0]}, + {{1}, [1, 1]}, + {{1, 2}, [1, 2]}, + {{1; 2}, [2, 1]}, + {{1, 2; 3, 4}, [2,2]}, + }; + + for i = 1:length(cases) + A = Cell(cases{i}{1}); + expected = cases{i}{2}; + + testCase.verifyEqual(size(A),expected); + end end function testLength(testCase) - testCase.verifyFail(); + cases = { + {{}, 0}, + {{1}, 1}, + {{1, 2}, 2}, + {{1; 2}, 2}, + {{1, 2; 3, 4}, 2}, + }; + + for i = 1:length(cases) + A = Cell(cases{i}{1}); + expected = cases{i}{2}; + + testCase.verifyEqual(length(A),expected); + end end function testTranspose(testCase) - testCase.verifyFail(); + testCase.verifyEqual(Cell({1, 2})', Cell({1; 2})); + testCase.verifyEqual(Cell({1; 2})', Cell({1, 2})); end function testRoundIndexWithProperty(testCase)