|
89 | 89 | function [] = test_attrs( varargin )
|
90 | 90 | %% Test: Access Attributes / Links
|
91 | 91 | f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
|
92 |
| - s1 = f.createSection('foo', 'bar'); |
93 |
| - |
94 |
| - assert(strcmp(s1.name, 'foo')); |
95 |
| - assert(strcmp(s1.type, 'bar')); |
96 |
| - assert(isempty(s1.repository)); |
97 |
| - assert(isempty(s1.mapping)); |
98 |
| - |
99 |
| - s1.repository = 'rep1'; |
100 |
| - s1.mapping = 'map1'; |
101 |
| - assert(strcmp(s1.repository, 'rep1')); |
102 |
| - assert(strcmp(s1.mapping, 'map1')); |
103 |
| - |
104 |
| - s1.repository = ''; |
105 |
| - s1.mapping = ''; |
106 |
| - assert(isempty(s1.repository)); |
107 |
| - assert(isempty(s1.mapping)); |
108 |
| - |
109 |
| - assert(isempty(s1.link)); |
110 |
| - |
111 |
| - % TODO rewrite tests for link / parent |
112 |
| - |
113 |
| - f = nix.File(fullfile(pwd, 'tests', 'test.h5'), nix.FileMode.ReadOnly); |
114 |
| - s1 = f.sections{3}; |
115 |
| - |
116 |
| - assert(strcmp(s1.name, 'Sessions')); |
117 |
| - assert(strcmp(s1.type, 'nix.metadata.section')); |
118 |
| - assert(isempty(s1.repository)); |
119 |
| - assert(isempty(s1.mapping)); |
120 |
| - |
121 |
| - subj = s1.sections{1}.sections{1}.link; |
122 |
| - assert(strcmp(subj.name, 'Subject')); |
123 |
| - |
124 |
| - emp_ty = s1.sections{1}.link; |
125 |
| - assert(isempty(emp_ty)); |
| 92 | + s = f.createSection('foo', 'bar'); |
| 93 | + |
| 94 | + assert(~isempty(s.id)); |
| 95 | + |
| 96 | + assert(strcmp(s.name, 'foo')); |
| 97 | + assert(strcmp(s.type, 'bar')); |
| 98 | + assert(isempty(s.repository)); |
| 99 | + assert(isempty(s.mapping)); |
| 100 | + assert(isempty(s.definition)); |
| 101 | + |
| 102 | + s.type = 'nixBlock'; |
| 103 | + s.definition = 'section definition'; |
| 104 | + s.repository = 'rep1'; |
| 105 | + s.mapping = 'map1'; |
| 106 | + assert(strcmp(s.type, 'nixBlock')); |
| 107 | + assert(strcmp(s.definition, 'section definition')); |
| 108 | + assert(strcmp(s.repository, 'rep1')); |
| 109 | + assert(strcmp(s.mapping, 'map1')); |
| 110 | + |
| 111 | + s.definition = ''; |
| 112 | + s.repository = ''; |
| 113 | + s.mapping = ''; |
| 114 | + assert(isempty(s.definition)); |
| 115 | + assert(isempty(s.repository)); |
| 116 | + assert(isempty(s.mapping)); |
126 | 117 | end
|
127 | 118 |
|
128 | 119 | function [] = test_properties( varargin )
|
|
0 commit comments