Mercurial > repos > public > sbplib
changeset 581:00261f8d7e15 feature/grids
Merge default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 07 Sep 2017 09:54:45 +0200 |
parents | a5f1b0267dba (current diff) 2ce903f28193 (diff) |
children | ce44af8d7dd1 |
files | |
diffstat | 2 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/Cell.m Thu Sep 07 09:21:04 2017 +0200 +++ b/Cell.m Thu Sep 07 09:54:45 2017 +0200 @@ -23,6 +23,10 @@ s = size(A.data); end + function b = isempty(A) + b = prod(size(A)) == 0; + end + function l = length(A) l = length(A.data); end
--- a/CellTest.m Thu Sep 07 09:21:04 2017 +0200 +++ b/CellTest.m Thu Sep 07 09:54:45 2017 +0200 @@ -36,6 +36,21 @@ end end +function testIsEmpty(testCase) + cases = { + {cell(0,0), true}, + {cell(1,0), true}, + {cell(0,1), true}, + {cell(1,1), false}, + }; + + for i = 1:length(cases) + A = Cell(cases{i}{1}); + expected = cases{i}{2}; + testCase.verifyEqual(isempty(A),expected); + end +end + function testTranspose(testCase) testCase.verifyEqual(Cell({1i, 2}).', Cell({1i; 2})); testCase.verifyEqual(Cell({1i; 2}).', Cell({1i, 2}));