|
28 | 28 | funcs{end+1} = @test_has_source;
|
29 | 29 | funcs{end+1} = @test_source_count;
|
30 | 30 | funcs{end+1} = @test_dimensions;
|
| 31 | + funcs{end+1} = @test_open_dimension_idx; |
31 | 32 | funcs{end+1} = @test_dimension_count;
|
32 | 33 | funcs{end+1} = @test_datatype;
|
33 | 34 | funcs{end+1} = @test_set_data_extent;
|
|
510 | 511 | assert(isequal(daAliasWa.dataExtent, [3 3]));
|
511 | 512 | end
|
512 | 513 |
|
| 514 | +function [] = test_open_dimension_idx( varargin ) |
| 515 | +%% Test: Open dimension by index |
| 516 | + fileName = fullfile(pwd, 'tests', 'testRW.h5'); |
| 517 | + f = nix.File(fileName, nix.FileMode.Overwrite); |
| 518 | + b = f.create_block('daTestBlock', 'test nixBlock'); |
| 519 | + da = b.create_data_array('daTest', 'test nixDataArray', nix.DataType.Double, [1 2]); |
| 520 | + |
| 521 | + da.append_set_dimension(); |
| 522 | + da.append_sampled_dimension(200); |
| 523 | + da.append_range_dimension([1, 2, 3, 4]); |
| 524 | + |
| 525 | + % for some weird reason getting the dimension by index starts with 1 |
| 526 | + % instead of 0 compared to all other index functions. |
| 527 | + assert(strcmp(da.open_dimension_idx(1).dimensionType, 'set')); |
| 528 | + assert(strcmp(da.open_dimension_idx(2).dimensionType, 'sample')); |
| 529 | + assert(strcmp(da.open_dimension_idx(3).dimensionType, 'range')); |
| 530 | +end |
| 531 | + |
513 | 532 | %% Test: Dimension count
|
514 | 533 | function [] = test_dimension_count( varargin )
|
515 | 534 | testFile = fullfile(pwd, 'tests', 'testRW.h5');
|
|
0 commit comments