comparison +blockmatrix/zeroTest.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 = zeroTest()
2 tests = functiontests(localfunctions);
3 end
4
5 function testZero(testCase)
6 cases = {
7 {
8 {[],[]},
9 {},
10 },
11 {
12 {0,0},
13 {[]};
14 },
15 {
16 {1,1},
17 {0};
18 },
19 {
20 {2,1},
21 {[0; 0]};
22 },
23 {
24 {1,2},
25 {[0 0]};
26 },
27 {
28 {[1 2],2},
29 {[0 0];[0 0; 0 0]};
30 },
31 {
32 {[1 2],[2 1]},
33 {[0 0],[0];[0 0; 0 0],[0; 0]};
34 },
35 {
36 {[3],[0]},
37 {zeros(3,0)},
38 },
39
40 {
41 {[0],[3]},
42 {zeros(0,3)},
43 },
44 {
45 {[0 2],[0 3]},
46 {
47 zeros(0,0), zeros(0,3);
48 zeros(2,0), zeros(2,3);
49 },
50 },
51 };
52
53 for i = 1:length(cases)
54 out = convertToFull(blockmatrix.zero(cases{i}{1}));
55 expected = cases{i}{2};
56 testCase.verifyEqual(out,expected);
57 end
58 end
59
60
61 function C = convertToFull(C)
62 [N,M] = size(C);
63 for i = 1:N
64 for j = 1:M
65 C{i,j} = full(C{i,j});
66 end
67 end
68 end