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 -->
9msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5exists", 2, 3);
10assert_checkerror("h5exists()",msgerr,77);
11msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5exists", 2, 3);
12assert_checkerror("h5exists(42)",msgerr,77);
13msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: string expected.\n"), "h5exists", 1);
14assert_checkerror("h5exists(42,42)",msgerr,999);
15msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: string expected.\n"), "h5exists", 2);
16assert_checkerror("h5exists(""42"",42)",msgerr,999);
17msgerr = msprintf(gettext("%s: %s\n"), "h5exists", msprintf(gettext("Invalid hdf5 file: %s."), "42"));
18assert_checkerror("h5exists(""42"",""42"")",msgerr,999);
19x = 123;
20y = 321;
21save(TMPDIR + "/xy.sod", "x", "y");
22a = h5open(TMPDIR + "/xy.sod", "r");
23msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5exists", 2, 3);
24assert_checkerror("h5exists(a)",msgerr,77);
25assert_checkfalse(h5exists(a,"42"));
26b= [%T %T %F];
27assert_checkequal(h5exists(a, ["x" "y" "z"]),b);
28assert_checkfalse(h5exists(a, "/tmp"));
29assert_checktrue(h5exists(a, "/x"));
30msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: string expected.\n"), "h5exists", 2);
31assert_checkerror("h5exists(a,a.root.x)",msgerr,999);
32c = [%T %T];
33assert_checkequal(h5exists(a, "/", ["SCILAB_sod_version", "SCILAB_scilab_version"]),c);
34assert_checktrue(h5exists(a, "/x", "SCILAB_Class"));
35h5close(a);
36assert_checkequal(h5exists(TMPDIR+"/xy.sod", ["x" "y" "z"]),b);
37assert_checkfalse(h5exists(TMPDIR+"/xy.sod", "/tmp"));
38assert_checktrue(h5exists(TMPDIR+"/xy.sod", "/x"));
39c = [%T %T];
40assert_checkequal(h5exists(TMPDIR+"/xy.sod", "/", ["SCILAB_sod_version", "SCILAB_scilab_version"]),c);
41assert_checktrue(h5exists(TMPDIR+"/xy.sod", "/x", "SCILAB_Class"));
42