diff +grid/evalOnTest.m @ 425:e56dbd9e4196 feature/grids

Merge feature/beams
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 07 Feb 2017 16:09:02 +0100
parents 4c3f55a628c8
children 190941ec12d8
line wrap: on
line diff
--- a/+grid/evalOnTest.m	Tue Feb 07 15:47:51 2017 +0100
+++ b/+grid/evalOnTest.m	Tue Feb 07 16:09:02 2017 +0100
@@ -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,