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"), "h5write", 3, 8); 11assert_checkerror("h5write()",msgerr,77); 12assert_checkerror("h5write(42)",msgerr,77); 13msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: string or H5Object expected.\n"), "h5write", 1); 14assert_checkerror("h5write(42,42,42)",msgerr,999); 15msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: string expected.\n"), "h5write", 2); 16assert_checkerror("h5write(""42"",42,42)",msgerr,999); 17msgerr = msprintf(gettext("%s: %s\n"), "h5write", msprintf(gettext("Invalid hdf5 file: %s."), "42")); 18assert_checkerror("h5write(""42"",""42"",42)",msgerr,999); 19 20x = matrix(1:20, 4, 5); 21save(TMPDIR + "/x.sod", "x"); 22a = h5open(TMPDIR + "/x.sod"); 23y = uint32(matrix(10:30, 7, 3)); 24h5write(a, "y", y); 25assert_checkequal(a.root.y.Data,y); 26h5write(a, "z", y, "H5T_MIPS_U32"); 27assert_checkequal(a.root.z.Data,y); 28 29x = uint32(matrix(1:(11*17), 11, 17)); 30dx = cat(2,cat(1,x(1:3,2:3),x(6:8,2:3)),cat(1,x(1:3,5:6),x(6:8,5:6)),.. 31 cat(1,x(1:3,8:9),x(6:8,8:9)),cat(1,x(1:3,11:12),x(6:8,11:12))); 32h5write(a, "t", x, [1 2], [2 4], [5 3], [3 2]); 33assert_checkequal(a.root.t.Data,dx); 34 35dx = x(2:6,4:6); 36h5write(a,"t2",x, [2 4],[5 3]); 37assert_checkequal(a.root.t2.data,dx); 38 39msgerr = msprintf(gettext("%s: %s\n"), "h5write", gettext("Invalid selection.")); 40assert_checkerror("h5write(a,""t3"",x, [22 22],[2 4],[5 3],[3 2])",msgerr,999); 41assert_checkerror("h5write(a,""t3"",x, [1 2],[12 44],[5 3],[3 2])",msgerr,999); 42h5close(a); 43