Mercurial > repos > public > sbplib
comparison +grid/primalDual1DTest.m @ 1331:60c875c18de3 feature/D2_boundary_opt
Merge with feature/poroelastic for Elastic schemes
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Thu, 10 Mar 2022 16:54:26 +0100 |
parents | 99f92bfc1157 |
children |
comparison
equal
deleted
inserted
replaced
1330:855871e0b852 | 1331:60c875c18de3 |
---|---|
1 function tests = primalDual1DTest() | |
2 tests = functiontests(localfunctions); | |
3 end | |
4 | |
5 | |
6 function testErrorInvalidLimits(testCase) | |
7 in = { | |
8 {10,{1}}, | |
9 {10,[0,1]}, | |
10 {10,{1,0}}, | |
11 }; | |
12 | |
13 for i = 1:length(in) | |
14 testCase.verifyError(@()grid.primalDual1D(in{i}{:}),'grid:primalDual1D:InvalidLimits',sprintf('in(%d) = %s',i,toString(in{i}))); | |
15 end | |
16 end | |
17 | |
18 function testCompiles(testCase) | |
19 in = { | |
20 {5, {0,1}}, | |
21 }; | |
22 | |
23 out = { | |
24 {[0; 0.25; 0.5; 0.75; 1], [0; 0.125; 0.375; 0.625; 0.875; 1]}, | |
25 }; | |
26 | |
27 for i = 1:length(in) | |
28 [gp, gd] = grid.primalDual1D(in{i}{:}); | |
29 testCase.verifyEqual(gp.points(),out{i}{1}); | |
30 testCase.verifyEqual(gd.points(),out{i}{2}); | |
31 end | |
32 end |