comparison +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
comparison
equal deleted inserted replaced
276:30321dc180e1 277:4c3f55a628c8
20 g = getTestGrid('1d'); 20 g = getTestGrid('1d');
21 21
22 for i = 1:length(in) 22 for i = 1:length(in)
23 gf = grid.evalOn(g,in{i}); 23 gf = grid.evalOn(g,in{i});
24 testCase.verifyEqual(gf, out{i}); 24 testCase.verifyEqual(gf, out{i});
25 end
26 end
27
28 % evalOn should give and error if the number of inputs to func is not the same as
29 % the number of dimensions of the grid.
30 function testNumberOfInputs(testCase)
31 cases = {
32 {getTestGrid('1d'), @(x,y)x-y},
33 {getTestGrid('2d'), @(x)x },
34 }
35
36 for i = 1:length(cases)
37 g = cases{i}{1};
38 f = cases{i}{2};
39 testCase.verifyError(@()grid.evalOn(g, f),'grid:evalOn:WrongNumberOfInputs',sprintf('in(%d) = %s',i,toString(f)));
25 end 40 end
26 end 41 end
27 42
28 function testInputScalarFunction1d(testCase) 43 function testInputScalarFunction1d(testCase)
29 in = { 44 in = {