comparison +blockmatrix/toMatrixTest.m @ 832:5573913a0949 feature/burgers1d

Merged with default, and updated +scheme/Burgers1D accordingly
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Tue, 11 Sep 2018 15:58:35 +0200
parents a5f1b0267dba
children
comparison
equal deleted inserted replaced
831:d0934d1143b7 832:5573913a0949
1 function tests = toMatrixTest()
2 tests = functiontests(localfunctions);
3 end
4
5 function testError(testCase)
6 testCase.verifyError(@()blockmatrix.toMatrix([]), 'blockmatrix:toMatrix:NotABlockmatrix')
7 end
8
9 function testToMatrix(testCase)
10 cases = {
11 {
12 {},
13 [],
14 },
15 {
16 {1, 2; 3, 4},
17 [1,2; 3,4],
18 }
19 {
20 {
21 [2 2; 2 1], [1; 2];
22 [2 2], [1]
23 },
24 [2 2 1;
25 2 1 2;
26 2 2 1],
27 },
28 {
29 {
30 [2 2; 2 1], [];
31 [2 2], [1]
32 },
33 [2 2 0;
34 2 1 0;
35 2 2 1],
36 },
37 {
38 {
39 [2 2; 2 1], [];
40 [2 2], []
41 },
42 [2 2;
43 2 1;
44 2 2],
45 },
46 {
47 {
48 [2 2; 2 1], [1; 2];
49 [], []
50 },
51 [2 2 1;
52 2 1 2],
53 },
54 {
55 {zeros(0,0)},
56 [],
57 },
58 {
59 {zeros(3,0), zeros(3,0)},
60 zeros(3,0),
61 },
62 {
63 {zeros(3,0); zeros(2,0)},
64 zeros(5,0),
65 },
66 {
67 {zeros(0,3), zeros(0,2)},
68 zeros(0,5),
69 },
70 };
71
72 for i = 1:length(cases)
73 in = cases{i}{1};
74 out = full(blockmatrix.toMatrix(in));
75 expected = cases{i}{2};
76 testCase.verifyEqual(out, expected);
77 end
78 end