|
16 | 16 | funcs{end+1} = @test_overwrite;
|
17 | 17 | funcs{end+1} = @test_is_open;
|
18 | 18 | funcs{end+1} = @test_file_mode;
|
| 19 | + funcs{end+1} = @test_validate; |
19 | 20 | funcs{end+1} = @test_create_block;
|
20 | 21 | funcs{end+1} = @test_block_count;
|
21 | 22 | funcs{end+1} = @test_create_section;
|
|
32 | 33 |
|
33 | 34 | %% Test: Open HDF5 file in ReadOnly mode
|
34 | 35 | function [] = test_read_only( varargin )
|
35 |
| - f = nix.File(fullfile(pwd,'tests','test.h5'), nix.FileMode.ReadOnly); |
| 36 | + f = nix.File(fullfile(pwd, 'tests', 'test.h5'), nix.FileMode.ReadOnly); |
36 | 37 | end
|
37 | 38 |
|
38 | 39 | %% Test: Open HDF5 file in ReadWrite mode
|
39 | 40 | function [] = test_read_write( varargin )
|
40 |
| - f = nix.File(fullfile(pwd,'tests','testRW.h5'), nix.FileMode.ReadWrite); |
| 41 | + f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.ReadWrite); |
41 | 42 | end
|
42 | 43 |
|
43 | 44 | %% Test: Open HDF5 file in Overwrite mode
|
44 | 45 | function [] = test_overwrite( varargin )
|
45 |
| - f = nix.File(fullfile(pwd,'tests','testRW.h5'), nix.FileMode.Overwrite); |
| 46 | + f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite); |
46 | 47 | end
|
47 | 48 |
|
48 | 49 | %% Test: File is open
|
49 | 50 | function [] = test_is_open( varargin )
|
50 |
| - f = nix.File(fullfile(pwd,'tests','testRW.h5'), nix.FileMode.ReadOnly); |
| 51 | + f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.ReadOnly); |
51 | 52 | assert(f.is_open());
|
52 | 53 | end
|
53 | 54 |
|
54 |
| -%% Test: File is open |
| 55 | +%% Test: File mode |
55 | 56 | function [] = test_file_mode( varargin )
|
56 |
| - testFile = fullfile(pwd,'tests','testRW.h5'); |
| 57 | + testFile = fullfile(pwd, 'tests', 'testRW.h5'); |
57 | 58 | f = nix.File(testFile, nix.FileMode.ReadOnly);
|
58 | 59 | assert(f.file_mode() == nix.FileMode.ReadOnly);
|
59 | 60 |
|
|
66 | 67 | assert(f.file_mode() == nix.FileMode.Overwrite);
|
67 | 68 | end
|
68 | 69 |
|
| 70 | +%% Test: Validate |
| 71 | +function [] = test_validate( varargin ) |
| 72 | + testFile = fullfile(pwd, 'tests', 'testRW.h5'); |
| 73 | + f = nix.File(testFile, nix.FileMode.Overwrite); |
| 74 | + validation = f.validate(); |
| 75 | + |
| 76 | + assert(validation.ok()); |
| 77 | + assert(~validation.hasErrors()); |
| 78 | + assert(~validation.hasWarnings()); |
| 79 | + assert(~size(validation.errors, 1)); |
| 80 | + assert(~size(validation.warnings, 1)); |
| 81 | +end |
| 82 | + |
69 | 83 | %% Test: Create Block
|
70 | 84 | function [] = test_create_block( varargin )
|
71 | 85 | test_file = nix.File(fullfile(pwd,'tests','testRW.h5'), nix.FileMode.Overwrite);
|
|
0 commit comments