Mercurial > repos > public > sbplib
diff +grid/evalOnTest.m @ 277:4c3f55a628c8 feature/beams
Made evalOn give more error message.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 07 Sep 2016 13:47:05 +0200 |
parents | ea8103ad2cc5 |
children | 190941ec12d8 |
line wrap: on
line diff
--- a/+grid/evalOnTest.m Wed Sep 07 10:13:26 2016 +0200 +++ b/+grid/evalOnTest.m Wed Sep 07 13:47:05 2016 +0200 @@ -25,6 +25,21 @@ end end +% evalOn should give and error if the number of inputs to func is not the same as +% the number of dimensions of the grid. +function testNumberOfInputs(testCase) + cases = { + {getTestGrid('1d'), @(x,y)x-y}, + {getTestGrid('2d'), @(x)x }, + } + + for i = 1:length(cases) + g = cases{i}{1}; + f = cases{i}{2}; + testCase.verifyError(@()grid.evalOn(g, f),'grid:evalOn:WrongNumberOfInputs',sprintf('in(%d) = %s',i,toString(f))); + end +end + function testInputScalarFunction1d(testCase) in = { @(x)1+x*0,