comparison CellTest.m @ 474:c91464ef1dd9 feature/sublassable_cellarray

Implement tests for horzcat and vertcat. Fix bugs found
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 02 Aug 2017 09:38:12 +0200
parents c78249d8e915
children e0e81e7df671
comparison
equal deleted inserted replaced
473:605a8c075388 474:c91464ef1dd9
9 function testIndexreference(testCase) 9 function testIndexreference(testCase)
10 testCase.verifyFail(); 10 testCase.verifyFail();
11 end 11 end
12 12
13 function testConcat(testCase) 13 function testConcat(testCase)
14 testCase.verifyFail(); 14 cases = {
15 {{},{}},
16 {{1},{}},
17 {{},{1}},
18 {{1},{2}},
19 {{1, 2},{3, 4}},
20 {{1; 2},{3; 4}},
21 };
22
23 horzCat = {
24 {},
25 {1},
26 {1},
27 {1,2},
28 {1, 2, 3, 4},
29 {1, 3; 2, 4},
30 };
31
32 vertCat = {
33 {},
34 {1},
35 {1},
36 {1; 2},
37 {1, 2; 3, 4},
38 {1; 2; 3; 4},
39 };
40
41 for i = 1:length(cases)
42 A = Cell(cases{i}{1});
43 B = Cell(cases{i}{2});
44
45 C_horz = [A, B];
46 C_vert = [A; B];
47
48 testCase.verifyEqual(C_horz.data, horzCat{i});
49 testCase.verifyEqual(C_vert.data, vertCat{i});
50
51 end
15 end 52 end