1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE
4//
5//  This file is distributed under the same license as the Scilab package.
6// =============================================================================
7//
8// <-- CLI SHELL MODE -->
9
10msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5flush", 1, 2);
11assert_checkerror("h5flush()",msgerr,77);
12msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A HDF5 object expected.\n"), "h5flush", 1);
13assert_checkerror("h5flush(42)",msgerr,999);
14
15deletefile(TMPDIR + "/test.h5");
16deletefile(TMPDIR + "/test1.h5");
17
18a = h5open(TMPDIR + "/test.h5", "w");
19x = uint8(1:24);
20h5dataset(a, "Dset1", [1 2 3 4 ; 1 1 1 1 ; 1 1 1 1 ; 1 1 1 1; 1 2 3 4], x, [1 2 3 4 ; 1 2 3 4 ; 1 1 1 1 ; 1 1 1 1 ; 1 1 1 1 ; 1 2 3 4]);
21assert_checkequal(h5ls(a,".","d"),["Dset1"]);
22
23b = h5open(TMPDIR + "/test1.h5");
24h5group(a, "Grp_1");
25h5write(a.root.Grp_1, "Dset_1", [1 2 ; 3 4]);
26h5flush(a);
27h5group(b, "BGrp");
28h5write(b("/BGrp"), "BDset", 11:18);
29h5close(b)
30
31h5mv(a.root.Grp_1, "Dset_1", a, "Dset_2")
32assert_checkequal(a.root.Datasets,["Dset1";"Dset_2"]);
33assert_checkequal(a.root.Dset_2.data,[1 2;3 4]);
34h5write(a.root.Grp_1, "Dset_1", [1 2 ; 3 4]);
35h5flush(a);
36h5mv(a.root.Grp_1, "Dset_1", a, "Dset_3")
37assert_checkequal(a.root.Dset_3.data,[1 2;3 4]);
38h5close(a);
39