diff +grid/primalDual1DTest.m @ 1259:99f92bfc1157 feature/poroelastic

Add staggered operators and 1D grids
author Martin Almquist <malmquist@stanford.edu>
date Tue, 14 Apr 2020 17:50:49 -0700
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/+grid/primalDual1DTest.m	Tue Apr 14 17:50:49 2020 -0700
@@ -0,0 +1,32 @@
+function tests = primalDual1DTest()
+    tests = functiontests(localfunctions);
+end
+
+
+function testErrorInvalidLimits(testCase)
+     in  = {
+        {10,{1}},
+        {10,[0,1]},
+        {10,{1,0}},
+    };
+
+    for i = 1:length(in)
+        testCase.verifyError(@()grid.primalDual1D(in{i}{:}),'grid:primalDual1D:InvalidLimits',sprintf('in(%d) = %s',i,toString(in{i})));
+    end
+end
+
+function testCompiles(testCase)
+    in  = {
+        {5, {0,1}},
+    };
+
+    out = {
+        {[0; 0.25; 0.5; 0.75; 1], [0; 0.125; 0.375; 0.625; 0.875; 1]},
+    };
+
+    for i = 1:length(in)
+        [gp, gd] = grid.primalDual1D(in{i}{:});
+        testCase.verifyEqual(gp.points(),out{i}{1});
+        testCase.verifyEqual(gd.points(),out{i}{2});
+    end
+end