|
204 | 204 | assert(~getBlock.delete_source('I do not exist'));
|
205 | 205 | end
|
206 | 206 |
|
| 207 | +%% Test: Fetch nix.DataArrays |
207 | 208 | function [] = test_list_arrays( varargin )
|
208 |
| -%% Test: fetch data arrays |
209 |
| - f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite); |
| 209 | + fileName = fullfile(pwd, 'tests', 'testRW.h5'); |
| 210 | + f = nix.File(fileName, nix.FileMode.Overwrite); |
210 | 211 | b = f.createBlock('arraytest', 'nixBlock');
|
211 | 212 |
|
212 | 213 | assert(isempty(b.dataArrays));
|
213 | 214 | tmp = b.create_data_array('arrayTest1', 'nixDataArray', 'double', [1 2]);
|
| 215 | + assert(size(b.dataArrays, 1) == 1); |
| 216 | + assert(size(f.blocks{1}.dataArrays, 1) == 1); |
214 | 217 | tmp = b.create_data_array('arrayTest2', 'nixDataArray', 'double', [3 4]);
|
215 | 218 | assert(size(b.dataArrays, 1) == 2);
|
| 219 | + assert(size(f.blocks{1}.dataArrays, 1) == 2); |
216 | 220 |
|
| 221 | + clear tmp b f; |
| 222 | + f = nix.File(fileName, nix.FileMode.ReadOnly); |
| 223 | + assert(size(f.blocks{1}.dataArrays, 1) == 2); |
217 | 224 | end
|
218 | 225 |
|
| 226 | +%% Test: Fetch nix.Sources |
219 | 227 | function [] = test_list_sources( varargin )
|
220 |
| -%% Test: fetch sources |
221 |
| - test_file = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite); |
222 |
| - getBlock = test_file.createBlock('sourcetest', 'nixBlock'); |
| 228 | + fileName = fullfile(pwd, 'tests', 'testRW.h5'); |
| 229 | + f = nix.File(fileName, nix.FileMode.Overwrite); |
| 230 | + b = f.createBlock('sourcetest', 'nixBlock'); |
223 | 231 |
|
224 |
| - assert(isempty(getBlock.sources)); |
225 |
| - tmp = getBlock.create_source('sourcetest1','nixSource'); |
226 |
| - tmp = getBlock.create_source('sourcetest2','nixSource'); |
227 |
| - assert(size(getBlock.sources, 1) == 2); |
| 232 | + assert(isempty(b.sources)); |
| 233 | + tmp = b.create_source('sourcetest1','nixSource'); |
| 234 | + assert(size(b.sources, 1) == 1); |
| 235 | + assert(size(f.blocks{1}.sources, 1) == 1); |
| 236 | + tmp = b.create_source('sourcetest2','nixSource'); |
| 237 | + assert(size(b.sources, 1) == 2); |
| 238 | + assert(size(f.blocks{1}.sources, 1) == 2); |
| 239 | + |
| 240 | + clear tmp b f; |
| 241 | + f = nix.File(fileName, nix.FileMode.ReadOnly); |
| 242 | + assert(size(f.blocks{1}.sources, 1) == 2); |
228 | 243 | end
|
229 | 244 |
|
| 245 | +%% Test: Fetch nix.Tags |
230 | 246 | function [] = test_list_tags( varargin )
|
231 |
| -%% Test: fetch tags |
232 |
| - f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite); |
| 247 | + fileName = fullfile(pwd, 'tests', 'testRW.h5'); |
| 248 | + f = nix.File(fileName, nix.FileMode.Overwrite); |
233 | 249 | b = f.createBlock('tagtest', 'nixBlock');
|
234 | 250 | position = [1.0 1.2 1.3 15.9];
|
235 | 251 |
|
236 | 252 | assert(isempty(b.tags));
|
237 | 253 | tmp = b.create_tag('tagtest1', 'nixTag', position);
|
| 254 | + assert(size(b.tags, 1) == 1); |
| 255 | + assert(size(f.blocks{1}.tags, 1) == 1); |
238 | 256 | tmp = b.create_tag('tagtest2', 'nixTag', position);
|
239 | 257 | assert(size(b.tags, 1) == 2);
|
| 258 | + assert(size(f.blocks{1}.tags, 1) == 2); |
| 259 | + |
| 260 | + clear tmp b f; |
| 261 | + f = nix.File(fileName, nix.FileMode.ReadOnly); |
| 262 | + assert(size(f.blocks{1}.tags, 1) == 2); |
240 | 263 | end
|
241 | 264 |
|
242 |
| -function [] = test_list_multitags( varargin ) |
243 | 265 | %% Test: fetch multitags
|
244 |
| - f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite); |
| 266 | +function [] = test_list_multitags( varargin ) |
| 267 | + fileName = fullfile(pwd, 'tests', 'testRW.h5'); |
| 268 | + f = nix.File(fileName, nix.FileMode.Overwrite); |
245 | 269 | b = f.createBlock('mTagTestBlock', 'nixBlock');
|
246 | 270 | tmp = b.create_data_array('mTagTestDataArray', 'nixDataArray', 'double', [1 2]);
|
247 | 271 |
|
248 | 272 | assert(isempty(b.multiTags));
|
249 | 273 | tmp = b.create_multi_tag('mTagTest1', 'nixMultiTag', b.dataArrays{1});
|
| 274 | + assert(size(b.multiTags, 1) == 1); |
| 275 | + assert(size(f.blocks{1}.multiTags, 1) == 1); |
250 | 276 | tmp = b.create_multi_tag('mTagTest2', 'nixMultiTag', b.dataArrays{1});
|
251 | 277 | assert(size(b.multiTags, 1) == 2);
|
| 278 | + assert(size(f.blocks{1}.multiTags, 1) == 2); |
| 279 | + |
| 280 | + clear tmp b f; |
| 281 | + f = nix.File(fileName, nix.FileMode.ReadOnly); |
| 282 | + assert(size(f.blocks{1}.multiTags, 1) == 2); |
252 | 283 | end
|
253 | 284 |
|
254 | 285 | function [] = test_open_array( varargin )
|
|
0 commit comments