diff +multiblock/DiffOpTest.m @ 820:501750fbbfdb

Merge with feature/grids
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 07 Sep 2018 14:40:58 +0200
parents 38f203f00f3a
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/+multiblock/DiffOpTest.m	Fri Sep 07 14:40:58 2018 +0200
@@ -0,0 +1,59 @@
+function tests = DiffOpTest()
+    tests = functiontests(localfunctions);
+end
+
+function testCreation(testCase)
+    do = newMultiblockOp();
+end
+
+function testSplitOp(testCase)
+    testCase.verifyFail();
+end
+
+function testBoundary_condition(testCase)
+    testCase.verifyFail();
+end
+
+function testInterface(testCase)
+    testCase.verifyFail();
+end
+
+function testSize(testCase)
+    mbDo = newMultiblockOp();
+    testCase.verifyEqual(mbDo.size(), 15)
+end
+
+
+function do = mockDiffOp(size, bc, interface)
+    do.H = 1;
+    do.D = 1;
+
+    do.size = size;
+    do.boundary_condition = bc;
+    do.interface = interface;
+end
+
+
+function do = newMultiblockOp()
+    grids = {
+        grid.Cartesian([0 1 2], [3 4 5]);
+        grid.Cartesian([1 2 3], [10 20]);
+    };
+
+    conn = cell(2,2);
+    conn{1, 2} = {'s','n'};
+
+    mbGrid = multiblock.Grid(grids, conn);
+
+    function [c, p] = boundary_condition(~,~,~,~)
+        c = 1; p = 1;
+    end
+
+    function [c, p] = interface(~,~,~,~)
+        c = 1; p = 1;
+    end
+
+    doHand = @(grid,~)mockDiffOp(@(~)prod(grid.size()), @boundary_condition, @interface);
+
+    do = multiblock.DiffOp(doHand, mbGrid, 0);
+end
\ No newline at end of file