|
3 | 3 | % Detailed explanation goes here
|
4 | 4 |
|
5 | 5 | funcs = {};
|
| 6 | + funcs{end+1} = @test_create_section; |
| 7 | + funcs{end+1} = @test_delete_section; |
6 | 8 | funcs{end+1} = @test_list_subsections;
|
7 | 9 | funcs{end+1} = @test_open_section;
|
8 | 10 | funcs{end+1} = @test_parent;
|
|
11 | 13 | funcs{end+1} = @test_properties;
|
12 | 14 | end
|
13 | 15 |
|
| 16 | +%% Test: Create Section |
| 17 | +function [] = test_create_section( varargin ) |
| 18 | + f = nix.File(fullfile(pwd,'tests','testRW.h5'), nix.FileMode.Overwrite); |
| 19 | + s = f.createSection('mainSection', 'nixSection'); |
| 20 | + |
| 21 | + assert(isempty(s.sections)); |
| 22 | + tmp = s.createSection('testSection1', 'nixSection'); |
| 23 | + tmp = s.createSection('testSection2', 'nixSection'); |
| 24 | + assert(size(s.sections, 1) == 2); |
| 25 | +end |
| 26 | + |
| 27 | +%% Test: Delete Section by entity or ID |
| 28 | +function [] = test_delete_section( varargin ) |
| 29 | + f = nix.File(fullfile(pwd,'tests','testRW.h5'), nix.FileMode.Overwrite); |
| 30 | + s = f.createSection('mainSection', 'nixSection'); |
| 31 | + tmp = s.createSection('testSection1', 'nixSection'); |
| 32 | + tmp = s.createSection('testSection2', 'nixSection'); |
| 33 | + |
| 34 | + assert(s.deleteSection(s.sections{2}.id)); |
| 35 | + assert(size(s.sections, 1) == 1); |
| 36 | + assert(s.deleteSection(s.sections{1})); |
| 37 | + assert(isempty(s.sections)); |
| 38 | + |
| 39 | + assert(~s.deleteSection('I do not exist')); |
| 40 | +end |
| 41 | + |
14 | 42 | function [] = test_list_subsections( varargin )
|
15 | 43 | %% Test: List/fetch subsections
|
16 | 44 | f = nix.File(fullfile(pwd, 'tests', 'test.h5'), nix.FileMode.ReadOnly);
|
|
0 commit comments