|
15 | 15 | funcs{end+1} = @test_delete_section;
|
16 | 16 | funcs{end+1} = @test_list_subsections;
|
17 | 17 | funcs{end+1} = @test_open_section;
|
| 18 | + funcs{end+1} = @test_open_section_idx; |
18 | 19 | funcs{end+1} = @test_parent;
|
19 | 20 | funcs{end+1} = @test_has_section;
|
20 | 21 | funcs{end+1} = @test_section_count;
|
|
24 | 25 | funcs{end+1} = @test_create_property_with_value;
|
25 | 26 | funcs{end+1} = @test_delete_property;
|
26 | 27 | funcs{end+1} = @test_open_property;
|
| 28 | + funcs{end+1} = @test_open_property_idx; |
27 | 29 | funcs{end+1} = @test_property_count;
|
28 | 30 | funcs{end+1} = @test_link;
|
29 | 31 | funcs{end+1} = @test_inherited_properties;
|
|
90 | 92 | assert(isempty(getSection));
|
91 | 93 | end
|
92 | 94 |
|
| 95 | +function [] = test_open_section_idx( varargin ) |
| 96 | +%% Test Open Section by index |
| 97 | + f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite); |
| 98 | + s = f.create_section('testSection', 'nixSection'); |
| 99 | + s1 = s.create_section('testSection1', 'nixSection'); |
| 100 | + s2 = s.create_section('testSection2', 'nixSection'); |
| 101 | + s3 = s.create_section('testSection3', 'nixSection'); |
| 102 | + |
| 103 | + assert(strcmp(f.sections{1}.open_section_idx(0).name, s1.name)); |
| 104 | + assert(strcmp(f.sections{1}.open_section_idx(1).name, s2.name)); |
| 105 | + assert(strcmp(f.sections{1}.open_section_idx(2).name, s3.name)); |
| 106 | +end |
| 107 | + |
93 | 108 | function [] = test_parent( varargin )
|
94 | 109 | %% Test: get parent section
|
95 | 110 | f = nix.File(fullfile(pwd, 'tests', 'test.h5'), nix.FileMode.ReadOnly);
|
|
278 | 293 | assert(~isempty(trial.open_property(trial.allProperties{1}.name)));
|
279 | 294 | end
|
280 | 295 |
|
| 296 | +function [] = test_open_property_idx( varargin ) |
| 297 | +%% Test Open Propery by index |
| 298 | + f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite); |
| 299 | + s = f.create_section('testSection', 'nixSection'); |
| 300 | + p1 = s.create_property('testProperty1', nix.DataType.Double); |
| 301 | + p2 = s.create_property('testProperty2', nix.DataType.Bool); |
| 302 | + p3 = s.create_property('testProperty3', nix.DataType.String); |
| 303 | + |
| 304 | + assert(strcmp(f.sections{1}.open_property_idx(0).name, p1.name)); |
| 305 | + assert(strcmp(f.sections{1}.open_property_idx(1).name, p2.name)); |
| 306 | + assert(strcmp(f.sections{1}.open_property_idx(2).name, p3.name)); |
| 307 | +end |
| 308 | + |
281 | 309 | %% Test: Property count
|
282 | 310 | function [] = test_property_count( varargin )
|
283 | 311 | testFile = fullfile(pwd, 'tests', 'testRW.h5');
|
|
0 commit comments