|
3 | 3 | % Detailed explanation goes here
|
4 | 4 |
|
5 | 5 | funcs = {};
|
| 6 | + funcs{end+1} = @test_attrs; |
6 | 7 | funcs{end+1} = @test_open_data;
|
7 | 8 | funcs{end+1} = @test_open_metadata;
|
8 | 9 | funcs{end+1} = @test_list_sources;
|
|
11 | 12 | funcs{end+1} = @test_remove_source;
|
12 | 13 | end
|
13 | 14 |
|
| 15 | +function [] = test_attrs( varargin ) |
| 16 | +%% Test: Access Attributes |
| 17 | + f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite); |
| 18 | + b = f.createBlock('daTestBlock', 'test nixBlock'); |
| 19 | + da = b.create_data_array('daTest', 'test nixDataArray', 'double', [1 2]); |
| 20 | + |
| 21 | + assert(~isempty(da.id)); |
| 22 | + assert(strcmp(da.name, 'daTest')); |
| 23 | + assert(strcmp(da.type, 'test nixDataArray')); |
| 24 | + |
| 25 | + %-- TODO does not work at the moment on the c++ side |
| 26 | + %da.type = 'nixDataArray'; |
| 27 | + %assert(strcmp(da.type, 'nixDataArray')); |
| 28 | + |
| 29 | + %assert(isempty(da.definition)); |
| 30 | + %b.definition = 'data array definition'; |
| 31 | + %assert(strcmp(da.definition, 'data array definition')); |
| 32 | + |
| 33 | + %da.definition = ''; |
| 34 | + %assert(isempty(da.definition)); |
| 35 | + |
| 36 | + assert(isempty(da.unit)); |
| 37 | + da.unit = 'ms'; |
| 38 | + assert(strcmp(da.unit, 'ms')); |
| 39 | + |
| 40 | + da.unit = ''; |
| 41 | + assert(isempty(da.unit)); |
| 42 | + |
| 43 | + assert(isempty(da.label)); |
| 44 | + da.label = 'data array label'; |
| 45 | + assert(strcmp(da.label, 'data array label')); |
| 46 | + |
| 47 | + da.label = ''; |
| 48 | + assert(isempty(da.label)); |
| 49 | +end |
| 50 | + |
14 | 51 | %% Test: Read all data from DataArray
|
15 | 52 | function [] = test_open_data( varargin )
|
16 | 53 | test_file = nix.File(fullfile(pwd, 'tests', 'test.h5'), nix.FileMode.ReadOnly);
|
|
0 commit comments