diff options
author | Shashank | 2017-05-29 12:40:26 +0530 |
---|---|---|
committer | Shashank | 2017-05-29 12:40:26 +0530 |
commit | 0345245e860375a32c9a437c4a9d9cae807134e9 (patch) | |
tree | ad51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /modules/hdf5/tests | |
download | scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.gz scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.bz2 scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.zip |
CMSCOPE changed
Diffstat (limited to 'modules/hdf5/tests')
132 files changed, 3694 insertions, 0 deletions
diff --git a/modules/hdf5/tests/nonreg_tests/bug_11954.dia.ref b/modules/hdf5/tests/nonreg_tests/bug_11954.dia.ref new file mode 100755 index 000000000..22770ce85 --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/bug_11954.dia.ref @@ -0,0 +1,21 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- Non-regression test for bug 11954 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=11954 +// +// <-- Short Description --> +// +// save with two times the same name leads to an HDF5 error. +x=123 + x = + + 123. +assert_checkerror("export_to_hdf5(TMPDIR + ""toto"" ,""x"", ""x"")", [], 999); +assert_checktrue(export_to_hdf5(TMPDIR + "bug_11954.sod", "x", "x", "-append")); diff --git a/modules/hdf5/tests/nonreg_tests/bug_11954.tst b/modules/hdf5/tests/nonreg_tests/bug_11954.tst new file mode 100755 index 000000000..9aa0197a3 --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/bug_11954.tst @@ -0,0 +1,19 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- Non-regression test for bug 11954 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=11954 +// +// <-- Short Description --> +// +// save with two times the same name leads to an HDF5 error. + +x=123 +assert_checkerror("export_to_hdf5(TMPDIR + ""toto"" ,""x"", ""x"")", [], 999); +assert_checktrue(export_to_hdf5(TMPDIR + "bug_11954.sod", "x", "x", "-append")); diff --git a/modules/hdf5/tests/nonreg_tests/bug_12285.dia.ref b/modules/hdf5/tests/nonreg_tests/bug_12285.dia.ref new file mode 100755 index 000000000..0c5005441 --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/bug_12285.dia.ref @@ -0,0 +1,53 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- Non-regression test for bug 12285 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=12285 +// +// <-- Short Description --> +// +// export_to_hdf5 function could not handle any matrix in append mode. +savefile = TMPDIR + "bug_12285.sod"; +a_list = list(1,2,3); +a_list_ref = a_list; +a_string = "a string"; +a_string_ref = a_string; +an_integer = 546; +an_integer_ref = an_integer; +a_complex_num = 1 + %i; +a_complex_num_ref = a_complex_num; +an_array_multidim = [1 2 3 4; 5 6 7 8; 9 10 11 12]; +an_array_multidim_ref = an_array_multidim; +//save all variables in the same file +assert_checktrue(export_to_hdf5(savefile, 'a_list', '-append')); +assert_checktrue(export_to_hdf5(savefile, 'a_string', '-append')); +assert_checktrue(export_to_hdf5(savefile, 'an_integer', '-append')); +assert_checktrue(export_to_hdf5(savefile, 'a_complex_num', '-append')); +assert_checktrue(export_to_hdf5(savefile, 'an_array_multidim', '-append')); +//clear variables +clear a_list a_string an_integer an_array_multidim +//load variables +assert_checktrue(import_from_hdf5(savefile, 'a_list')); +assert_checktrue(import_from_hdf5(savefile, 'a_string')); +assert_checktrue(import_from_hdf5(savefile, 'an_integer')); +assert_checktrue(import_from_hdf5(savefile, 'a_complex_num')); +assert_checktrue(import_from_hdf5(savefile, 'an_array_multidim')); +//check variables values +assert_checkequal(a_list, a_list_ref); +assert_checkequal(a_string, a_string_ref); +assert_checkequal(an_integer, an_integer_ref); +assert_checkequal(a_complex_num, a_complex_num_ref); +assert_checkequal(an_array_multidim, an_array_multidim_ref); +//append file with a already existing variable name but different data +a_list = "ok ok i am not a list"; +a_list_ref = a_list; +assert_checktrue(export_to_hdf5(savefile, 'a_list', '-append')); +clear a_list +assert_checktrue(import_from_hdf5(savefile, 'a_list')); +assert_checkequal(a_list, a_list_ref); diff --git a/modules/hdf5/tests/nonreg_tests/bug_12285.tst b/modules/hdf5/tests/nonreg_tests/bug_12285.tst new file mode 100755 index 000000000..4b40c5f02 --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/bug_12285.tst @@ -0,0 +1,63 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- Non-regression test for bug 12285 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=12285 +// +// <-- Short Description --> +// +// export_to_hdf5 function could not handle any matrix in append mode. + +savefile = TMPDIR + "bug_12285.sod"; +a_list = list(1,2,3); +a_list_ref = a_list; + +a_string = "a string"; +a_string_ref = a_string; + +an_integer = 546; +an_integer_ref = an_integer; + +a_complex_num = 1 + %i; +a_complex_num_ref = a_complex_num; + +an_array_multidim = [1 2 3 4; 5 6 7 8; 9 10 11 12]; +an_array_multidim_ref = an_array_multidim; + +//save all variables in the same file +assert_checktrue(export_to_hdf5(savefile, 'a_list', '-append')); +assert_checktrue(export_to_hdf5(savefile, 'a_string', '-append')); +assert_checktrue(export_to_hdf5(savefile, 'an_integer', '-append')); +assert_checktrue(export_to_hdf5(savefile, 'a_complex_num', '-append')); +assert_checktrue(export_to_hdf5(savefile, 'an_array_multidim', '-append')); + +//clear variables +clear a_list a_string an_integer an_array_multidim + +//load variables +assert_checktrue(import_from_hdf5(savefile, 'a_list')); +assert_checktrue(import_from_hdf5(savefile, 'a_string')); +assert_checktrue(import_from_hdf5(savefile, 'an_integer')); +assert_checktrue(import_from_hdf5(savefile, 'a_complex_num')); +assert_checktrue(import_from_hdf5(savefile, 'an_array_multidim')); + +//check variables values +assert_checkequal(a_list, a_list_ref); +assert_checkequal(a_string, a_string_ref); +assert_checkequal(an_integer, an_integer_ref); +assert_checkequal(a_complex_num, a_complex_num_ref); +assert_checkequal(an_array_multidim, an_array_multidim_ref); + +//append file with a already existing variable name but different data +a_list = "ok ok i am not a list"; +a_list_ref = a_list; +assert_checktrue(export_to_hdf5(savefile, 'a_list', '-append')); +clear a_list +assert_checktrue(import_from_hdf5(savefile, 'a_list')); +assert_checkequal(a_list, a_list_ref); diff --git a/modules/hdf5/tests/nonreg_tests/bug_13689.dia.ref b/modules/hdf5/tests/nonreg_tests/bug_13689.dia.ref new file mode 100755 index 000000000..5c68126e5 --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/bug_13689.dia.ref @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2015 - Scilab Enterprises - Calixte DENIZET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- Non-regression test for bug 13689 --> +// +// <-- CLI SHELL MODE --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/13689 +// +// <-- Short Description --> +// +// There were errors in reading enum from hdf5 files +h5 = h5open(SCI + "/modules/hdf5/tests/nonreg_tests/bug_13689.h5"); +assert_checkequal(h5.root.BooleanT.data, uint8(1)); +assert_checkequal(h5.root.BooleanF.data, uint8(0)); diff --git a/modules/hdf5/tests/nonreg_tests/bug_13689.h5 b/modules/hdf5/tests/nonreg_tests/bug_13689.h5 Binary files differnew file mode 100755 index 000000000..cdabcf3a5 --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/bug_13689.h5 diff --git a/modules/hdf5/tests/nonreg_tests/bug_13689.tst b/modules/hdf5/tests/nonreg_tests/bug_13689.tst new file mode 100755 index 000000000..11df6d2ac --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/bug_13689.tst @@ -0,0 +1,21 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2015 - Scilab Enterprises - Calixte DENIZET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- Non-regression test for bug 13689 --> +// +// <-- CLI SHELL MODE --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/13689 +// +// <-- Short Description --> +// +// There were errors in reading enum from hdf5 files + +h5 = h5open(SCI + "/modules/hdf5/tests/nonreg_tests/bug_13689.h5"); +assert_checkequal(h5.root.BooleanT.data, uint8(1)); +assert_checkequal(h5.root.BooleanF.data, uint8(0));
\ No newline at end of file diff --git a/modules/hdf5/tests/nonreg_tests/bug_5629.dia.ref b/modules/hdf5/tests/nonreg_tests/bug_5629.dia.ref new file mode 100755 index 000000000..137f0db6b --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/bug_5629.dia.ref @@ -0,0 +1,23 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - DIGITEO - Pierre MARECHAL +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +// <-- Non-regression test for bug 5629 and 5630 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=5629 +// http://bugzilla.scilab.org/show_bug.cgi?id=5630 +// +// <-- Short Description --> +// 5629: export_to_hdf5 overwrites an empty directory without warning +// 5630: export_to_hdf5 on an existing directory with file in it mess with the permissions. +commonName = pathconvert(TMPDIR+"/bug_5629",%F); +myvar = 1; +mkdir(commonName); +if ~isdir(commonName) then bugmes();quit;end +if ~execstr("export_to_hdf5(commonName,""myvar"")","errcatch") then bugmes();quit;end +if ~isdir(commonName) then bugmes();quit;end +if isfile(commonName) then bugmes();quit;end diff --git a/modules/hdf5/tests/nonreg_tests/bug_5629.tst b/modules/hdf5/tests/nonreg_tests/bug_5629.tst new file mode 100755 index 000000000..64e1aa89e --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/bug_5629.tst @@ -0,0 +1,27 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - DIGITEO - Pierre MARECHAL +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> + +// <-- Non-regression test for bug 5629 and 5630 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=5629 +// http://bugzilla.scilab.org/show_bug.cgi?id=5630 +// +// <-- Short Description --> +// 5629: export_to_hdf5 overwrites an empty directory without warning +// 5630: export_to_hdf5 on an existing directory with file in it mess with the permissions. + +commonName = pathconvert(TMPDIR+"/bug_5629",%F); +myvar = 1; + +mkdir(commonName); +if ~isdir(commonName) then pause,end +if ~execstr("export_to_hdf5(commonName,""myvar"")","errcatch") then pause, end +if ~isdir(commonName) then pause,end +if isfile(commonName) then pause,end diff --git a/modules/hdf5/tests/nonreg_tests/bug_6440.dia.ref b/modules/hdf5/tests/nonreg_tests/bug_6440.dia.ref new file mode 100755 index 000000000..dfc24505f --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/bug_6440.dia.ref @@ -0,0 +1,39 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 6440 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=6440 +// +// <-- Short Description --> +// xcos demos did not work and returned an error "Unable to open file". +// +dataDirP1 = TMPDIR + '/世界您好'; +dataDirP2 = TMPDIR + '/世界您好/JOSÉDO~1/'; +dataFile = dataDirP2 + '/my_data.sod"; +mkdir(dataDirP1); +mkdir(dataDirP2); +if ~isdir(dataDirP2) then bugmes();quit;end +A = [1 2 3]; +B = [4 5 6]; +data = [A B]; +c1 = pwd(); +ierr = execstr("export_to_hdf5(dataFile, ''data'');","errcatch"); +c2 = pwd(); +if ierr <> 0 then bugmes();quit;end +if c1 <> c2 then bugmes();quit;end +if ~isfile(dataFile) then bugmes();quit;end +clear data; +c3 = pwd(); +ierr = execstr("import_from_hdf5(dataFile);","errcatch"); +c4 = pwd(); +if ierr <> 0 then bugmes();quit;end +if c3 <> c4 then bugmes();quit;end +if ~and(data == [A B]) then bugmes();quit;end diff --git a/modules/hdf5/tests/nonreg_tests/bug_6440.tst b/modules/hdf5/tests/nonreg_tests/bug_6440.tst new file mode 100755 index 000000000..312b44425 --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/bug_6440.tst @@ -0,0 +1,48 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 6440 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=6440 +// +// <-- Short Description --> +// xcos demos did not work and returned an error "Unable to open file". +// + +dataDirP1 = TMPDIR + '/世界您好'; +dataDirP2 = TMPDIR + '/世界您好/JOSÉDO~1/'; +dataFile = dataDirP2 + '/my_data.sod"; + +mkdir(dataDirP1); +mkdir(dataDirP2); +if ~isdir(dataDirP2) then pause,end + +A = [1 2 3]; +B = [4 5 6]; + +data = [A B]; +c1 = pwd(); +ierr = execstr("export_to_hdf5(dataFile, ''data'');","errcatch"); +c2 = pwd(); + +if ierr <> 0 then pause,end +if c1 <> c2 then pause,end +if ~isfile(dataFile) then pause, end + +clear data; + +c3 = pwd(); +ierr = execstr("import_from_hdf5(dataFile);","errcatch"); +c4 = pwd(); + +if ierr <> 0 then pause,end +if c3 <> c4 then pause,end + +if ~and(data == [A B]) then pause,end diff --git a/modules/hdf5/tests/nonreg_tests/bug_7224.cos b/modules/hdf5/tests/nonreg_tests/bug_7224.cos Binary files differnew file mode 100755 index 000000000..60bf4c05c --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/bug_7224.cos diff --git a/modules/hdf5/tests/nonreg_tests/bug_7224.dia.ref b/modules/hdf5/tests/nonreg_tests/bug_7224.dia.ref new file mode 100755 index 000000000..ffce1e8b2 --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/bug_7224.dia.ref @@ -0,0 +1,21 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- XCOS TEST --> +// <-- Non-regression test for bug 7224 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=7224 +// +// <-- Short Description --> +// HDF5 functions don't unlock file wih empty matrix. +// +importScicosDiagram("SCI/modules/hdf5/tests/nonreg_tests/bug_7224.cos"); +emp=[]; // or list([]), scicos_diagram(), etc. +export_to_hdf5(TMPDIR + "/emp.sod","emp"); +import_from_hdf5(TMPDIR + "/emp.sod"); +if execstr("export_to_hdf5(TMPDIR + ""/emp.sod"",""emp"");","errcatch") then bugmes();quit;end diff --git a/modules/hdf5/tests/nonreg_tests/bug_7224.tst b/modules/hdf5/tests/nonreg_tests/bug_7224.tst new file mode 100755 index 000000000..53469cc2d --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/bug_7224.tst @@ -0,0 +1,24 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- XCOS TEST --> + +// <-- Non-regression test for bug 7224 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=7224 +// +// <-- Short Description --> +// HDF5 functions don't unlock file wih empty matrix. +// + +importScicosDiagram("SCI/modules/hdf5/tests/nonreg_tests/bug_7224.cos"); + +emp=[]; // or list([]), scicos_diagram(), etc. +export_to_hdf5(TMPDIR + "/emp.sod","emp"); +import_from_hdf5(TMPDIR + "/emp.sod"); +if execstr("export_to_hdf5(TMPDIR + ""/emp.sod"",""emp"");","errcatch") then pause, end diff --git a/modules/hdf5/tests/nonreg_tests/bug_8170.dia.ref b/modules/hdf5/tests/nonreg_tests/bug_8170.dia.ref new file mode 100755 index 000000000..75564e850 --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/bug_8170.dia.ref @@ -0,0 +1,18 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- XCOS TEST --> +// <-- Non-regression test for bug 8170 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=8170 +// +// <-- Short Description --> +// Check format of HDF5 file +// +ierr = execstr("import_from_hdf5(SCI + ""/modules/hdf5/tests/nonreg_tests/bug_8170.sod"")", "errcatch"); +if ierr == 0 then bugmes();quit;end diff --git a/modules/hdf5/tests/nonreg_tests/bug_8170.sod b/modules/hdf5/tests/nonreg_tests/bug_8170.sod Binary files differnew file mode 100755 index 000000000..8cacf4ab9 --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/bug_8170.sod diff --git a/modules/hdf5/tests/nonreg_tests/bug_8170.tst b/modules/hdf5/tests/nonreg_tests/bug_8170.tst new file mode 100755 index 000000000..da4bda96d --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/bug_8170.tst @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- XCOS TEST --> + +// <-- Non-regression test for bug 8170 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=8170 +// +// <-- Short Description --> +// Check format of HDF5 file +// + +ierr = execstr("import_from_hdf5(SCI + ""/modules/hdf5/tests/nonreg_tests/bug_8170.sod"")", "errcatch"); +if ierr == 0 then pause, end diff --git a/modules/hdf5/tests/nonreg_tests/bug_8383.dia.ref b/modules/hdf5/tests/nonreg_tests/bug_8383.dia.ref new file mode 100755 index 000000000..7d427bcc4 --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/bug_8383.dia.ref @@ -0,0 +1,58 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- Non-regression test for bug 8383 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=8383 +// +// <-- Short Description --> +// export and import "void" and "undefined" fields in {m,l}list +// +//undefined test +//list(1, undef, 3) +list_undefined = list(1); +list_undefined(3) = 3; +export_to_hdf5(TMPDIR + "/list_undefined1.sod", "list_undefined"); +clear list_undefined; +import_from_hdf5(TMPDIR + "/list_undefined1.sod"); +if or(definedfields(list_undefined) == 2) == %t then bugmes();quit;end +//list(undef, 3) +list_undefined = list(1); +list_undefined(3) = 3; +list_undefined(1) = null(); +export_to_hdf5(TMPDIR + "/list_undefined2.sod", "list_undefined"); +clear list_undefined; +import_from_hdf5(TMPDIR + "/list_undefined2.sod"); +if or(definedfields(list_undefined) == 1) == %t then bugmes();quit;end +//list(1, undef) +list_undefined = list(1); +list_undefined(3) = 3; +list_undefined(3) = null(); +export_to_hdf5(TMPDIR + "/list_undefined3.sod", "list_undefined"); +clear list_undefined; +import_from_hdf5(TMPDIR + "/list_undefined3.sod"); +if or(definedfields(list_undefined) == 2) == %t then bugmes();quit;end +//void test +//list(1, void, 3) +list_void = list(1,,3); +export_to_hdf5(TMPDIR + "/list_void1.sod", "list_void"); +clear list_void; +import_from_hdf5(TMPDIR + "/list_void1.sod"); +if type(list_void(2)) <> 0 then bugmes();quit;end +//list(void, 3) +list_void = list(,2); +export_to_hdf5(TMPDIR + "/list_void2.sod", "list_void"); +clear list_void; +import_from_hdf5(TMPDIR + "/list_void2.sod"); +if type(list_void(1)) <> 0 then bugmes();quit;end +//list(1, void) +list_void = list(1,); +export_to_hdf5(TMPDIR + "/list_void3.sod", "list_void"); +clear list_void; +import_from_hdf5(TMPDIR + "/list_void3.sod"); +if type(list_void(2)) <> 0 then bugmes();quit;end diff --git a/modules/hdf5/tests/nonreg_tests/bug_8383.tst b/modules/hdf5/tests/nonreg_tests/bug_8383.tst new file mode 100755 index 000000000..e1c0bd0d6 --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/bug_8383.tst @@ -0,0 +1,78 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- Non-regression test for bug 8383 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=8383 +// +// <-- Short Description --> +// export and import "void" and "undefined" fields in {m,l}list +// + + +//undefined test + + +//list(1, undef, 3) + +list_undefined = list(1); +list_undefined(3) = 3; +export_to_hdf5(TMPDIR + "/list_undefined1.sod", "list_undefined"); +clear list_undefined; +import_from_hdf5(TMPDIR + "/list_undefined1.sod"); +if or(definedfields(list_undefined) == 2) == %t then pause, end + +//list(undef, 3) + +list_undefined = list(1); +list_undefined(3) = 3; +list_undefined(1) = null(); +export_to_hdf5(TMPDIR + "/list_undefined2.sod", "list_undefined"); +clear list_undefined; +import_from_hdf5(TMPDIR + "/list_undefined2.sod"); +if or(definedfields(list_undefined) == 1) == %t then pause, end + + +//list(1, undef) + +list_undefined = list(1); +list_undefined(3) = 3; +list_undefined(3) = null(); +export_to_hdf5(TMPDIR + "/list_undefined3.sod", "list_undefined"); +clear list_undefined; +import_from_hdf5(TMPDIR + "/list_undefined3.sod"); +if or(definedfields(list_undefined) == 2) == %t then pause, end + +//void test + + +//list(1, void, 3) + +list_void = list(1,,3); +export_to_hdf5(TMPDIR + "/list_void1.sod", "list_void"); +clear list_void; +import_from_hdf5(TMPDIR + "/list_void1.sod"); +if type(list_void(2)) <> 0 then pause, end + + +//list(void, 3) + +list_void = list(,2); +export_to_hdf5(TMPDIR + "/list_void2.sod", "list_void"); +clear list_void; +import_from_hdf5(TMPDIR + "/list_void2.sod"); +if type(list_void(1)) <> 0 then pause, end + +//list(1, void) + +list_void = list(1,); +export_to_hdf5(TMPDIR + "/list_void3.sod", "list_void"); +clear list_void; +import_from_hdf5(TMPDIR + "/list_void3.sod"); +if type(list_void(2)) <> 0 then pause, end + diff --git a/modules/hdf5/tests/nonreg_tests/bug_9510.dia.ref b/modules/hdf5/tests/nonreg_tests/bug_9510.dia.ref new file mode 100755 index 000000000..2df8df8d1 --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/bug_9510.dia.ref @@ -0,0 +1,18 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- Non-regression test for bug 9510 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=9510 +// +// <-- Short Description --> +// export does not return %f when try to export unmanaged data types. +// +deff('y=f(x)','y=2*x'); +if export_to_hdf5(TMPDIR+"/functions.sod","f") <> %f then pause end +if ls(TMPDIR+"/functions.sod") <> [] then pause end diff --git a/modules/hdf5/tests/nonreg_tests/bug_9510.tst b/modules/hdf5/tests/nonreg_tests/bug_9510.tst new file mode 100755 index 000000000..a06f3dc6d --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/bug_9510.tst @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- Non-regression test for bug 9510 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=9510 +// +// <-- Short Description --> +// export does not return %f when try to export unmanaged data types. +// + + +deff('y=f(x)','y=2*x'); +if export_to_hdf5(TMPDIR+"/functions.sod","f") <> %f then pause end +if ls(TMPDIR+"/functions.sod") <> [] then pause end diff --git a/modules/hdf5/tests/nonreg_tests/matrix_as_input.dia.ref b/modules/hdf5/tests/nonreg_tests/matrix_as_input.dia.ref new file mode 100755 index 000000000..fa3c73ce2 --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/matrix_as_input.dia.ref @@ -0,0 +1,13 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- Short Description --> +// If the input of import_from_hdf5 was a matrix of string, a segfault occurred +// +myFiles=ls(SCI+"/modules/types/tests/java/org/scilab/tests/modules/types/referenceData/*"); +// Used to segfault +assert_checkerror("import_from_hdf5(myFiles)",[],999); diff --git a/modules/hdf5/tests/nonreg_tests/matrix_as_input.tst b/modules/hdf5/tests/nonreg_tests/matrix_as_input.tst new file mode 100755 index 000000000..d1da83c5d --- /dev/null +++ b/modules/hdf5/tests/nonreg_tests/matrix_as_input.tst @@ -0,0 +1,14 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- Short Description --> +// If the input of import_from_hdf5 was a matrix of string, a segfault occurred +// + +myFiles=ls(SCI+"/modules/types/tests/java/org/scilab/tests/modules/types/referenceData/*"); +// Used to segfault +assert_checkerror("import_from_hdf5(myFiles)",[],999); diff --git a/modules/hdf5/tests/sample_scilab_data/booleanmatrix.sod b/modules/hdf5/tests/sample_scilab_data/booleanmatrix.sod Binary files differnew file mode 100755 index 000000000..9b713073a --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/booleanmatrix.sod diff --git a/modules/hdf5/tests/sample_scilab_data/booleanmatrix_v1.sod b/modules/hdf5/tests/sample_scilab_data/booleanmatrix_v1.sod Binary files differnew file mode 100755 index 000000000..57b4b4c84 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/booleanmatrix_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/booleanscalar.sod b/modules/hdf5/tests/sample_scilab_data/booleanscalar.sod Binary files differnew file mode 100755 index 000000000..bb38c8943 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/booleanscalar.sod diff --git a/modules/hdf5/tests/sample_scilab_data/booleanscalar_v1.sod b/modules/hdf5/tests/sample_scilab_data/booleanscalar_v1.sod Binary files differnew file mode 100755 index 000000000..c25e37198 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/booleanscalar_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/booleansparse.sod b/modules/hdf5/tests/sample_scilab_data/booleansparse.sod Binary files differnew file mode 100755 index 000000000..e4ff56b48 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/booleansparse.sod diff --git a/modules/hdf5/tests/sample_scilab_data/booleansparse_v1.sod b/modules/hdf5/tests/sample_scilab_data/booleansparse_v1.sod Binary files differnew file mode 100755 index 000000000..cbbc939f2 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/booleansparse_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/emptymatrix.sod b/modules/hdf5/tests/sample_scilab_data/emptymatrix.sod Binary files differnew file mode 100755 index 000000000..aaeb4b5ae --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/emptymatrix.sod diff --git a/modules/hdf5/tests/sample_scilab_data/emptysparse.sod b/modules/hdf5/tests/sample_scilab_data/emptysparse.sod Binary files differnew file mode 100755 index 000000000..2225d30d5 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/emptysparse.sod diff --git a/modules/hdf5/tests/sample_scilab_data/emptysparse_v1.sod b/modules/hdf5/tests/sample_scilab_data/emptysparse_v1.sod Binary files differnew file mode 100755 index 000000000..fc48348f7 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/emptysparse_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/hypermatrix.sod b/modules/hdf5/tests/sample_scilab_data/hypermatrix.sod Binary files differnew file mode 100755 index 000000000..5f5451bf4 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/hypermatrix.sod diff --git a/modules/hdf5/tests/sample_scilab_data/hypermatrix_v1.sod b/modules/hdf5/tests/sample_scilab_data/hypermatrix_v1.sod Binary files differnew file mode 100755 index 000000000..b86350f47 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/hypermatrix_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/hypermatrixcomplex.sod b/modules/hdf5/tests/sample_scilab_data/hypermatrixcomplex.sod Binary files differnew file mode 100755 index 000000000..0b2eb0671 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/hypermatrixcomplex.sod diff --git a/modules/hdf5/tests/sample_scilab_data/hypermatrixcomplex_v1.sod b/modules/hdf5/tests/sample_scilab_data/hypermatrixcomplex_v1.sod Binary files differnew file mode 100755 index 000000000..3575e106a --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/hypermatrixcomplex_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/int16.sod b/modules/hdf5/tests/sample_scilab_data/int16.sod Binary files differnew file mode 100755 index 000000000..eb14265c3 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/int16.sod diff --git a/modules/hdf5/tests/sample_scilab_data/int16_v1.sod b/modules/hdf5/tests/sample_scilab_data/int16_v1.sod Binary files differnew file mode 100755 index 000000000..b1491bfb5 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/int16_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/int32.sod b/modules/hdf5/tests/sample_scilab_data/int32.sod Binary files differnew file mode 100755 index 000000000..3f9c9a83d --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/int32.sod diff --git a/modules/hdf5/tests/sample_scilab_data/int32_v1.sod b/modules/hdf5/tests/sample_scilab_data/int32_v1.sod Binary files differnew file mode 100755 index 000000000..80bedff78 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/int32_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/int8.sod b/modules/hdf5/tests/sample_scilab_data/int8.sod Binary files differnew file mode 100755 index 000000000..09632f92e --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/int8.sod diff --git a/modules/hdf5/tests/sample_scilab_data/int8_v1.sod b/modules/hdf5/tests/sample_scilab_data/int8_v1.sod Binary files differnew file mode 100755 index 000000000..30aad01dd --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/int8_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/list.sod b/modules/hdf5/tests/sample_scilab_data/list.sod Binary files differnew file mode 100755 index 000000000..d6b84c83f --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/list.sod diff --git a/modules/hdf5/tests/sample_scilab_data/list_v1.sod b/modules/hdf5/tests/sample_scilab_data/list_v1.sod Binary files differnew file mode 100755 index 000000000..dcd8be101 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/list_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/listnested.sod b/modules/hdf5/tests/sample_scilab_data/listnested.sod Binary files differnew file mode 100755 index 000000000..18146397b --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/listnested.sod diff --git a/modules/hdf5/tests/sample_scilab_data/listnested_v1.sod b/modules/hdf5/tests/sample_scilab_data/listnested_v1.sod Binary files differnew file mode 100755 index 000000000..df64a37ec --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/listnested_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/matricedouble.sod b/modules/hdf5/tests/sample_scilab_data/matricedouble.sod Binary files differnew file mode 100755 index 000000000..7cd064713 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/matricedouble.sod diff --git a/modules/hdf5/tests/sample_scilab_data/matricedouble_v1.sod b/modules/hdf5/tests/sample_scilab_data/matricedouble_v1.sod Binary files differnew file mode 100755 index 000000000..4ae93150d --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/matricedouble_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/matricedoublecomplex.sod b/modules/hdf5/tests/sample_scilab_data/matricedoublecomplex.sod Binary files differnew file mode 100755 index 000000000..faf017732 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/matricedoublecomplex.sod diff --git a/modules/hdf5/tests/sample_scilab_data/matricedoublecomplex_v1.sod b/modules/hdf5/tests/sample_scilab_data/matricedoublecomplex_v1.sod Binary files differnew file mode 100755 index 000000000..07f34e7a6 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/matricedoublecomplex_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/matricedoublecomplexscalar.sod b/modules/hdf5/tests/sample_scilab_data/matricedoublecomplexscalar.sod Binary files differnew file mode 100755 index 000000000..1805cb05b --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/matricedoublecomplexscalar.sod diff --git a/modules/hdf5/tests/sample_scilab_data/matricedoublecomplexscalar_v1.sod b/modules/hdf5/tests/sample_scilab_data/matricedoublecomplexscalar_v1.sod Binary files differnew file mode 100755 index 000000000..3839e66cb --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/matricedoublecomplexscalar_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/matricedoublescalar.sod b/modules/hdf5/tests/sample_scilab_data/matricedoublescalar.sod Binary files differnew file mode 100755 index 000000000..b4e6eba9e --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/matricedoublescalar.sod diff --git a/modules/hdf5/tests/sample_scilab_data/matricedoublescalar_v1.sod b/modules/hdf5/tests/sample_scilab_data/matricedoublescalar_v1.sod Binary files differnew file mode 100755 index 000000000..eec40e399 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/matricedoublescalar_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/matricestring.sod b/modules/hdf5/tests/sample_scilab_data/matricestring.sod Binary files differnew file mode 100755 index 000000000..1c9c55fe9 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/matricestring.sod diff --git a/modules/hdf5/tests/sample_scilab_data/matricestring_v1.sod b/modules/hdf5/tests/sample_scilab_data/matricestring_v1.sod Binary files differnew file mode 100755 index 000000000..dfb6dd536 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/matricestring_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/matricestringscalar.sod b/modules/hdf5/tests/sample_scilab_data/matricestringscalar.sod Binary files differnew file mode 100755 index 000000000..557c89c46 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/matricestringscalar.sod diff --git a/modules/hdf5/tests/sample_scilab_data/matricestringscalar_v1.sod b/modules/hdf5/tests/sample_scilab_data/matricestringscalar_v1.sod Binary files differnew file mode 100755 index 000000000..79cf610d8 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/matricestringscalar_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/mlist.sod b/modules/hdf5/tests/sample_scilab_data/mlist.sod Binary files differnew file mode 100755 index 000000000..fa9cf23ba --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/mlist.sod diff --git a/modules/hdf5/tests/sample_scilab_data/mlist_v1.sod b/modules/hdf5/tests/sample_scilab_data/mlist_v1.sod Binary files differnew file mode 100755 index 000000000..d4043e226 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/mlist_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/polynomials.sod b/modules/hdf5/tests/sample_scilab_data/polynomials.sod Binary files differnew file mode 100755 index 000000000..c4eab308c --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/polynomials.sod diff --git a/modules/hdf5/tests/sample_scilab_data/polynomials_v1.sod b/modules/hdf5/tests/sample_scilab_data/polynomials_v1.sod Binary files differnew file mode 100755 index 000000000..74020fdc4 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/polynomials_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/polynomialscoef.sod b/modules/hdf5/tests/sample_scilab_data/polynomialscoef.sod Binary files differnew file mode 100755 index 000000000..a0dcfb9df --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/polynomialscoef.sod diff --git a/modules/hdf5/tests/sample_scilab_data/polynomialscoef_v1.sod b/modules/hdf5/tests/sample_scilab_data/polynomialscoef_v1.sod Binary files differnew file mode 100755 index 000000000..3d28f1f7e --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/polynomialscoef_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/sparsematrix.sod b/modules/hdf5/tests/sample_scilab_data/sparsematrix.sod Binary files differnew file mode 100755 index 000000000..562fd34a1 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/sparsematrix.sod diff --git a/modules/hdf5/tests/sample_scilab_data/sparsematrix_v1.sod b/modules/hdf5/tests/sample_scilab_data/sparsematrix_v1.sod Binary files differnew file mode 100755 index 000000000..53d5dd836 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/sparsematrix_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/tlist.sod b/modules/hdf5/tests/sample_scilab_data/tlist.sod Binary files differnew file mode 100755 index 000000000..b8e0f9c05 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/tlist.sod diff --git a/modules/hdf5/tests/sample_scilab_data/tlist_v1.sod b/modules/hdf5/tests/sample_scilab_data/tlist_v1.sod Binary files differnew file mode 100755 index 000000000..ddeef5c95 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/tlist_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/uint16.sod b/modules/hdf5/tests/sample_scilab_data/uint16.sod Binary files differnew file mode 100755 index 000000000..e3e728bf5 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/uint16.sod diff --git a/modules/hdf5/tests/sample_scilab_data/uint16_v1.sod b/modules/hdf5/tests/sample_scilab_data/uint16_v1.sod Binary files differnew file mode 100755 index 000000000..bfcaa5db8 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/uint16_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/uint32.sod b/modules/hdf5/tests/sample_scilab_data/uint32.sod Binary files differnew file mode 100755 index 000000000..718fa6c36 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/uint32.sod diff --git a/modules/hdf5/tests/sample_scilab_data/uint32_v1.sod b/modules/hdf5/tests/sample_scilab_data/uint32_v1.sod Binary files differnew file mode 100755 index 000000000..81cb8898a --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/uint32_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/uint8.sod b/modules/hdf5/tests/sample_scilab_data/uint8.sod Binary files differnew file mode 100755 index 000000000..994cecaf9 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/uint8.sod diff --git a/modules/hdf5/tests/sample_scilab_data/uint8_v1.sod b/modules/hdf5/tests/sample_scilab_data/uint8_v1.sod Binary files differnew file mode 100755 index 000000000..74e1ea141 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/uint8_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/undefinedelement.sod b/modules/hdf5/tests/sample_scilab_data/undefinedelement.sod Binary files differnew file mode 100755 index 000000000..946fc4deb --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/undefinedelement.sod diff --git a/modules/hdf5/tests/sample_scilab_data/undefinedelement_v1.sod b/modules/hdf5/tests/sample_scilab_data/undefinedelement_v1.sod Binary files differnew file mode 100755 index 000000000..60442eaa9 --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/undefinedelement_v1.sod diff --git a/modules/hdf5/tests/sample_scilab_data/voidelement.sod b/modules/hdf5/tests/sample_scilab_data/voidelement.sod Binary files differnew file mode 100755 index 000000000..74cf225fd --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/voidelement.sod diff --git a/modules/hdf5/tests/sample_scilab_data/voidelement_v1.sod b/modules/hdf5/tests/sample_scilab_data/voidelement_v1.sod Binary files differnew file mode 100755 index 000000000..657d7e0ce --- /dev/null +++ b/modules/hdf5/tests/sample_scilab_data/voidelement_v1.sod diff --git a/modules/hdf5/tests/unit_tests/h5attr.dia.ref b/modules/hdf5/tests/unit_tests/h5attr.dia.ref new file mode 100755 index 000000000..e180f2649 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5attr.dia.ref @@ -0,0 +1,65 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5attr", 4, 5); +assert_checkerror("h5attr()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5attr", 4, 5); +assert_checkerror("h5attr(42)",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string or a H5Object expected.\n"), "h5attr", 1); +assert_checkerror("h5attr(42,42,42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5attr", 2); +assert_checkerror("h5attr(""42"",42,42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5attr", 3); +assert_checkerror("h5attr(""42"",""42"",42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5attr", msprintf(gettext("Invalid hdf5 file: %s."),"42")); +assert_checkerror("h5attr(""42"",""42"",""42"",42)",msgerr,999); +x = 1:5 + %pi; +save(TMPDIR + "/x.sod", "x"); +a = h5open(TMPDIR + "/x.sod"); +msgerr = msprintf(gettext("%s: %s\n"), "h5attr", msprintf(gettext("Invalid name: %s."), "42")); +assert_checkerror("h5attr(a,""42"",""42"",42)",msgerr,999); +h5attr(a, ".", "My Attribute", int8(123)); +assert_checkequal(a.root("My Attribute").Data,int8(123)); +msgerr = msprintf(gettext("%s: %s\n"), "h5attr", msprintf(gettext("Attribute %s already exists."), "My Attribute")); +assert_checkerror("h5attr(a, ""."", ""My Attribute"", %pi)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5attr", 3); +assert_checkerror("h5attr(a,""."",a.root.Attributes,int8(2))",msgerr,999); +h5group(a,"Group_1"); +h5attr(a,"/Group_1","New",[5 6]); +assert_checkequal(a.root.Group_1.New.Data,[5 6]); +h5write(a,"Group_1/Dset_1",[1 2;3 4]); +h5attr(a,"Group_1/Dset_1","Second",[7 8]); +assert_checkequal(a.root.Group_1.Dset_1.Second.Data,[7 8]); +msgerr = msprintf(gettext("%s: %s\n"), "h5attr", msprintf(gettext("Invalid hdf5 file: %s."),TMPDIR+"/y.sod")); +assert_checkerror("h5attr(TMPDIR+""/y.sod"",""."",""New"",int8(16))",msgerr,999); +h5attr(TMPDIR+"/x.sod", ".", "New", int8(8)); +assert_checkequal(a.root.New.Data,int8(8)); +h5attr(a, "/x", "My Dataset Attribute", int16(321)); +h5close(a); +// h5writeattr testing +x = 1:5 + %pi; +save(TMPDIR + "/x.sod", "x"); +a = h5open(TMPDIR + "/x.sod"); +h5writeattr(a, ".", "My Attribute", int8(123)); +assert_checkequal(a.root("My Attribute").Data,int8(123)); +msgerr = msprintf(gettext("%s: %s\n"), "h5writeattr", msprintf(gettext("Attribute %s already exists."), "My Attribute")); +assert_checkerror("h5writeattr(a, ""."", ""My Attribute"", %pi)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5writeattr", 3); +assert_checkerror("h5writeattr(a,""."",a.root.Attributes,int8(2))",msgerr,999); +h5group(a,"Group_1"); +h5writeattr(a,"/Group_1","New",[5 6]); +assert_checkequal(a.root.Group_1.New.Data,[5 6]); +h5write(a,"Group_1/Dset_1",[1 2;3 4]); +h5writeattr(a,"Group_1/Dset_1","Second",[7 8]); +assert_checkequal(a.root.Group_1.Dset_1.Second.Data,[7 8]); +msgerr = msprintf(gettext("%s: %s\n"), "h5writeattr", msprintf(gettext("Invalid hdf5 file: %s."), TMPDIR+"/y.sod")); +assert_checkerror("h5writeattr(TMPDIR+""/y.sod"",""."",""New"",int8(16))",msgerr,999); +h5attr(TMPDIR+"/x.sod", ".", "New", int8(8)); +assert_checkequal(a.root.New.Data,int8(8)); +h5writeattr(a, "/x", "My Dataset Attribute", int16(321)); +h5close(a); diff --git a/modules/hdf5/tests/unit_tests/h5attr.tst b/modules/hdf5/tests/unit_tests/h5attr.tst new file mode 100755 index 000000000..31f4af344 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5attr.tst @@ -0,0 +1,78 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5attr", 4, 5); +assert_checkerror("h5attr()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5attr", 4, 5); +assert_checkerror("h5attr(42)",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string or a H5Object expected.\n"), "h5attr", 1); +assert_checkerror("h5attr(42,42,42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5attr", 2); +assert_checkerror("h5attr(""42"",42,42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5attr", 3); +assert_checkerror("h5attr(""42"",""42"",42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5attr", msprintf(gettext("Invalid hdf5 file: %s."),"42")); +assert_checkerror("h5attr(""42"",""42"",""42"",42)",msgerr,999); + +x = 1:5 + %pi; +save(TMPDIR + "/x.sod", "x"); + +a = h5open(TMPDIR + "/x.sod"); + +msgerr = msprintf(gettext("%s: %s\n"), "h5attr", msprintf(gettext("Invalid name: %s."), "42")); +assert_checkerror("h5attr(a,""42"",""42"",42)",msgerr,999); + +h5attr(a, ".", "My Attribute", int8(123)); +assert_checkequal(a.root("My Attribute").Data,int8(123)); +msgerr = msprintf(gettext("%s: %s\n"), "h5attr", msprintf(gettext("Attribute %s already exists."), "My Attribute")); +assert_checkerror("h5attr(a, ""."", ""My Attribute"", %pi)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5attr", 3); +assert_checkerror("h5attr(a,""."",a.root.Attributes,int8(2))",msgerr,999); + +h5group(a,"Group_1"); +h5attr(a,"/Group_1","New",[5 6]); +assert_checkequal(a.root.Group_1.New.Data,[5 6]); +h5write(a,"Group_1/Dset_1",[1 2;3 4]); +h5attr(a,"Group_1/Dset_1","Second",[7 8]); +assert_checkequal(a.root.Group_1.Dset_1.Second.Data,[7 8]); + +msgerr = msprintf(gettext("%s: %s\n"), "h5attr", msprintf(gettext("Invalid hdf5 file: %s."),TMPDIR+"/y.sod")); +assert_checkerror("h5attr(TMPDIR+""/y.sod"",""."",""New"",int8(16))",msgerr,999); +h5attr(TMPDIR+"/x.sod", ".", "New", int8(8)); +assert_checkequal(a.root.New.Data,int8(8)); + + +h5attr(a, "/x", "My Dataset Attribute", int16(321)); +h5close(a); + +// h5writeattr testing +x = 1:5 + %pi; +save(TMPDIR + "/x.sod", "x"); +a = h5open(TMPDIR + "/x.sod"); +h5writeattr(a, ".", "My Attribute", int8(123)); +assert_checkequal(a.root("My Attribute").Data,int8(123)); +msgerr = msprintf(gettext("%s: %s\n"), "h5writeattr", msprintf(gettext("Attribute %s already exists."), "My Attribute")); +assert_checkerror("h5writeattr(a, ""."", ""My Attribute"", %pi)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5writeattr", 3); +assert_checkerror("h5writeattr(a,""."",a.root.Attributes,int8(2))",msgerr,999); + +h5group(a,"Group_1"); +h5writeattr(a,"/Group_1","New",[5 6]); +assert_checkequal(a.root.Group_1.New.Data,[5 6]); +h5write(a,"Group_1/Dset_1",[1 2;3 4]); +h5writeattr(a,"Group_1/Dset_1","Second",[7 8]); +assert_checkequal(a.root.Group_1.Dset_1.Second.Data,[7 8]); + +msgerr = msprintf(gettext("%s: %s\n"), "h5writeattr", msprintf(gettext("Invalid hdf5 file: %s."), TMPDIR+"/y.sod")); +assert_checkerror("h5writeattr(TMPDIR+""/y.sod"",""."",""New"",int8(16))",msgerr,999); +h5attr(TMPDIR+"/x.sod", ".", "New", int8(8)); +assert_checkequal(a.root.New.Data,int8(8)); + +h5writeattr(a, "/x", "My Dataset Attribute", int16(321)); +h5close(a); diff --git a/modules/hdf5/tests/unit_tests/h5close.dia.ref b/modules/hdf5/tests/unit_tests/h5close.dia.ref new file mode 100755 index 000000000..c30b2fa44 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5close.dia.ref @@ -0,0 +1,37 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A H5Object expected.\n"), "h5close", 1); +assert_checkerror("h5close(42)",msgerr,999); +assert_checkerror("h5close(""42"")",msgerr,999); +w = [1 2;3 4]; +save(TMPDIR + "/w.sod", "w"); +a = h5open(TMPDIR + "/w.sod", "r"); +h5close(a); +msgerr = msprintf(gettext("%s: Can not print H5Object: invalid object.\n"), "%H5Object_p"); +assert_checkerror("disp(a)",msgerr,999); + +a = h5open(TMPDIR + "/w.sod", "r"); +dataset = a.root.w; +attr = dataset.SCILAB_Class; +h5close(dataset); +msgerr = msprintf(gettext("%s: Can not print H5Object: invalid object.\n"), "%H5Object_p"); +assert_checkerror("disp(attr)",msgerr,999); + +//a still open +dataset = a.root.w; +attr = dataset.SCILAB_Class; +//dataset is a descendant of a, so closing a will close dataset +h5close(a); +assert_checkerror("disp(a)",msgerr,999); + +assert_checkerror("disp(dataset)",msgerr,999); + +assert_checkerror("disp(attr)",msgerr,999); + +assert_checkequal(deletefile(TMPDIR+"/w.sod"),%T); diff --git a/modules/hdf5/tests/unit_tests/h5close.tst b/modules/hdf5/tests/unit_tests/h5close.tst new file mode 100755 index 000000000..2463c62c6 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5close.tst @@ -0,0 +1,40 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A H5Object expected.\n"), "h5close", 1); +assert_checkerror("h5close(42)",msgerr,999); +assert_checkerror("h5close(""42"")",msgerr,999); + +w = [1 2;3 4]; + +save(TMPDIR + "/w.sod", "w"); + +a = h5open(TMPDIR + "/w.sod", "r"); +h5close(a); +msgerr = msprintf(gettext("%s: Can not print H5Object: invalid object.\n"), "%H5Object_p"); +assert_checkerror("disp(a)",msgerr,999); + +a = h5open(TMPDIR + "/w.sod", "r"); +dataset = a.root.w; +attr = dataset.SCILAB_Class; +h5close(dataset); +msgerr = msprintf(gettext("%s: Can not print H5Object: invalid object.\n"), "%H5Object_p"); +assert_checkerror("disp(attr)",msgerr,999); + +//a still open +dataset = a.root.w; +attr = dataset.SCILAB_Class; +//dataset is a descendant of a, so closing a will close dataset +h5close(a); +assert_checkerror("disp(a)",msgerr,999); +assert_checkerror("disp(dataset)",msgerr,999); +assert_checkerror("disp(attr)",msgerr,999); + + +assert_checkequal(deletefile(TMPDIR+"/w.sod"),%T); diff --git a/modules/hdf5/tests/unit_tests/h5cp.dia.ref b/modules/hdf5/tests/unit_tests/h5cp.dia.ref new file mode 100755 index 000000000..c8cee3db5 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5cp.dia.ref @@ -0,0 +1,52 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5cp", 2, 4); +assert_checkerror("h5cp()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5cp", 2, 4); +assert_checkerror("h5cp(42)",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5cp", 1); +assert_checkerror("h5cp(12.0,14.0)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5cp", 2); +assert_checkerror("h5cp(""12.0"",14.0)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5cp", msprintf(gettext("Invalid hdf5 file: %s."), "12.0")); +assert_checkerror("h5cp(""12.0"",""14.0"")",msgerr,999); +a = h5open(TMPDIR + "/test.h5"); +msgerr = msprintf(gettext("%s: %s\n"), "h5cp", gettext("Invalid hdf5 file: empty filename.")); +assert_checkerror("h5cp(a,""14.0"")",msgerr,999); +b = h5open(TMPDIR + "/test1.h5"); +c = h5open(TMPDIR + "/test2.h5"); +h5group(a, "Grp_1"); +h5write(a.root.Grp_1, "Dset_1", [1 2 ; 3 4]); +h5flush(a); +h5group(b, "BGrp"); +h5write(b("/BGrp"), "BDset", 11:18); +h5close(b); +h5group(c, "Grp_3"); +h5group(c, "Grp_4"); +h5write(c.root.Grp_3,"Dset_3",[5 6 ; 7 8]); +h5cp(a.root.Grp_1, "Dset_1", a, "Dset_2"); +assert_checkequal(a.root.Datasets,["Dset_2"]); +h5cp(a.root.Grp_1, "Dset_1", a); +assert_checkequal(a.root.Datasets,["Dset_1" ; "Dset_2"]); +h5group(a,"/Grp_1/SubGrp_1"); +h5cp(a, "/Grp_1/SubGrp_1", a); +assert_checkequal(a.root.Groups,["Grp_1" ; "SubGrp_1"]); +h5cp(a.root.Grp_1, c, "Dset_1"); +assert_checkequal(c.root.Groups,["Dset_1" ; "Grp_3" ; "Grp_4"]); +h5cp(c.root.Grp_3,c.root.Grp_4); +assert_checkequal(c.root.Grp_4.Groups,["Grp_3"]); +h5flush(c); +h5close(c); +h5cp(TMPDIR +"/test1.h5", "/BGrp/BDset", a.root.Grp_1); +assert_checkequal(a.root.Grp_1.Datasets,["BDset" ; "Dset_1"]); +h5cp(TMPDIR +"/test1.h5", "/BGrp/BDset", a.root.Grp_1, "The Foo Dataset"); +assert_checkequal(a.root.Grp_1.Datasets,["BDset" ; "Dset_1" ; "The Foo Dataset"]); +h5cp(TMPDIR +"/test2.h5", "/Grp_4",TMPDIR +"/test1.h5","/CGrp"); +assert_checkequal(h5ls(TMPDIR+"/test1.h5",".","g"),["BGrp" ; "CGrp"]); +h5close(a); diff --git a/modules/hdf5/tests/unit_tests/h5cp.tst b/modules/hdf5/tests/unit_tests/h5cp.tst new file mode 100755 index 000000000..9c347330e --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5cp.tst @@ -0,0 +1,67 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5cp", 2, 4); +assert_checkerror("h5cp()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5cp", 2, 4); +assert_checkerror("h5cp(42)",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5cp", 1); +assert_checkerror("h5cp(12.0,14.0)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5cp", 2); +assert_checkerror("h5cp(""12.0"",14.0)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5cp", msprintf(gettext("Invalid hdf5 file: %s."), "12.0")); +assert_checkerror("h5cp(""12.0"",""14.0"")",msgerr,999); + +a = h5open(TMPDIR + "/test.h5"); + +msgerr = msprintf(gettext("%s: %s\n"), "h5cp", gettext("Invalid hdf5 file: empty filename.")); +assert_checkerror("h5cp(a,""14.0"")",msgerr,999); + +b = h5open(TMPDIR + "/test1.h5"); +c = h5open(TMPDIR + "/test2.h5"); +h5group(a, "Grp_1"); +h5write(a.root.Grp_1, "Dset_1", [1 2 ; 3 4]); +h5flush(a); +h5group(b, "BGrp"); +h5write(b("/BGrp"), "BDset", 11:18); +h5close(b); +h5group(c, "Grp_3"); +h5group(c, "Grp_4"); +h5write(c.root.Grp_3,"Dset_3",[5 6 ; 7 8]); + +h5cp(a.root.Grp_1, "Dset_1", a, "Dset_2"); +assert_checkequal(a.root.Datasets,["Dset_2"]); + +h5cp(a.root.Grp_1, "Dset_1", a); +assert_checkequal(a.root.Datasets,["Dset_1" ; "Dset_2"]); + +h5group(a,"/Grp_1/SubGrp_1"); +h5cp(a, "/Grp_1/SubGrp_1", a); +assert_checkequal(a.root.Groups,["Grp_1" ; "SubGrp_1"]); + +h5cp(a.root.Grp_1, c, "Dset_1"); +assert_checkequal(c.root.Groups,["Dset_1" ; "Grp_3" ; "Grp_4"]); + +h5cp(c.root.Grp_3,c.root.Grp_4); +assert_checkequal(c.root.Grp_4.Groups,["Grp_3"]); + +h5flush(c); +h5close(c); + +h5cp(TMPDIR +"/test1.h5", "/BGrp/BDset", a.root.Grp_1); +assert_checkequal(a.root.Grp_1.Datasets,["BDset" ; "Dset_1"]); + +h5cp(TMPDIR +"/test1.h5", "/BGrp/BDset", a.root.Grp_1, "The Foo Dataset"); +assert_checkequal(a.root.Grp_1.Datasets,["BDset" ; "Dset_1" ; "The Foo Dataset"]); + +h5cp(TMPDIR +"/test2.h5", "/Grp_4",TMPDIR +"/test1.h5","/CGrp"); +assert_checkequal(h5ls(TMPDIR+"/test1.h5",".","g"),["BGrp" ; "CGrp"]); + + +h5close(a); diff --git a/modules/hdf5/tests/unit_tests/h5dataset.dia.ref b/modules/hdf5/tests/unit_tests/h5dataset.dia.ref new file mode 100755 index 000000000..94897fe43 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5dataset.dia.ref @@ -0,0 +1,43 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5dataset", 5, 7); +assert_checkerror("h5dataset()",msgerr,77); +assert_checkerror("h5dataset(42)",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string or a H5Object expected.\n"), "h5dataset", 1); +assert_checkerror("h5dataset(42,42,42,42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5dataset", 2); +assert_checkerror("h5dataset(""42"",42,42,42,42)",msgerr,999); +//msgerr = msprintf(gettext("%s: Wrong size for input argument #%d: five row vector expected.\n"), "h5dataset", 3); +//assert_checkerror("h5dataset(""42"",""42"",42,42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A double matrix expected.\n"), "h5dataset", 3); +assert_checkerror("h5dataset(""42"",""42"",[""42"",""42"",""42"",""42"",""42""],42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong size for input argument #%d: six row vector expected.\n"), "h5dataset", 5); +assert_checkerror("h5dataset(""42"",""42"",[42;42;42;42;42],42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5dataset", msprintf(gettext("Invalid hdf5 file: %s."), "42")); +assert_checkerror("h5dataset(""42"",""42"",[42;42;42;42;42],42,[42;42;42;42;42;42])",msgerr,999); +a = h5open(TMPDIR + "/test.h5", "w"); +msgerr = msprintf(gettext("%s: %s\n"), "h5dataset", gettext("Incompatible dimensions")); +assert_checkerror("h5dataset(a,""42"",[42;42;42;42;42],42,[42;42;42;42;42;42])",msgerr,999); +x = uint32(1:100); +y = uint32(matrix(1:100,10,10)); +z = uint32(zeros(7,12)); +h5write(a,"dx",y',[2 1 ],[ 4 1 ],[ 2 1 ],[ 1 9 ]); +z(3:6,3:11) = a.root.dx.Data; +msgerr = msprintf(gettext("%s: %s\n"), "h5dataset", msprintf(gettext("Cannot create the dataset: %s"), "")); +assert_checkerror("h5dataset(a, """", [10 10 ; 2 1 ; 4 1 ; 2 1 ; 1 9], x, [7 12 ; 9 14 ; 3 3 ; 1 1 ; 1 1 ; 4 9])",msgerr,999); +h5dataset(a, "D_set1", [10 10 ; 2 1 ; 4 1 ; 2 1 ; 1 9], x, [7 12 ; 9 14 ; 3 3 ; 1 1 ; 1 1 ; 4 9]); +assert_checkequal(a.root.D_set1.Data,z'); +z = uint32(zeros(9,12)); +z(1:5,1) = uint32([1;21;41;61;81]); +h5dataset(a, "D_set2", [5 20 ; 1 1 ; 1 1 ; 1 1 ; 5 1], y, [9 12 ; 9 14 ; 1 1 ; 1 1 ; 1 1 ; 5 1]); +assert_checkequal(a.root.D_set2.Data,z'); +msgerr = msprintf(gettext("%s: %s\n") + "%s: %s\n", "h5dataset", gettext("Cannot write data in the dataset."), gettext("HDF5 description"), "src and dest data spaces have different sizes."); +assert_checkerror("h5dataset(a, ""Dset_3"", [10 10 ; 2 1 ; 4 1 ; 2 1 ; 1 9], x, [10 10 ; 11 14 ; 3 3 ; 1 1 ; 1 1 ; 1 1])",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5dataset", gettext("Invalid target dataspace.")); +assert_checkerror("h5dataset(a, ""D_set4"", [10 10 ; 2 1 ; 4 1 ; 2 1 ; 1 9], x, [7 12 ; 6 11 ; 3 3 ; 1 1 ; 1 1 ; 4 9])",msgerr,999); diff --git a/modules/hdf5/tests/unit_tests/h5dataset.tst b/modules/hdf5/tests/unit_tests/h5dataset.tst new file mode 100755 index 000000000..177929c9a --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5dataset.tst @@ -0,0 +1,52 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5dataset", 5, 7); +assert_checkerror("h5dataset()",msgerr,77); +assert_checkerror("h5dataset(42)",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string or a H5Object expected.\n"), "h5dataset", 1); +assert_checkerror("h5dataset(42,42,42,42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5dataset", 2); +assert_checkerror("h5dataset(""42"",42,42,42,42)",msgerr,999); +//msgerr = msprintf(gettext("%s: Wrong size for input argument #%d: five row vector expected.\n"), "h5dataset", 3); +//assert_checkerror("h5dataset(""42"",""42"",42,42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A double matrix expected.\n"), "h5dataset", 3); +assert_checkerror("h5dataset(""42"",""42"",[""42"",""42"",""42"",""42"",""42""],42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong size for input argument #%d: six row vector expected.\n"), "h5dataset", 5); +assert_checkerror("h5dataset(""42"",""42"",[42;42;42;42;42],42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5dataset", msprintf(gettext("Invalid hdf5 file: %s."), "42")); +assert_checkerror("h5dataset(""42"",""42"",[42;42;42;42;42],42,[42;42;42;42;42;42])",msgerr,999); + +a = h5open(TMPDIR + "/test.h5", "w"); + +msgerr = msprintf(gettext("%s: %s\n"), "h5dataset", gettext("Incompatible dimensions")); +assert_checkerror("h5dataset(a,""42"",[42;42;42;42;42],42,[42;42;42;42;42;42])",msgerr,999); + +x = uint32(1:100); +y = uint32(matrix(1:100,10,10)); + +z = uint32(zeros(7,12)); +h5write(a,"dx",y',[2 1 ],[ 4 1 ],[ 2 1 ],[ 1 9 ]); +z(3:6,3:11) = a.root.dx.Data; + +msgerr = msprintf(gettext("%s: %s\n"), "h5dataset", msprintf(gettext("Cannot create the dataset: %s"), "")); +assert_checkerror("h5dataset(a, """", [10 10 ; 2 1 ; 4 1 ; 2 1 ; 1 9], x, [7 12 ; 9 14 ; 3 3 ; 1 1 ; 1 1 ; 4 9])",msgerr,999); +h5dataset(a, "D_set1", [10 10 ; 2 1 ; 4 1 ; 2 1 ; 1 9], x, [7 12 ; 9 14 ; 3 3 ; 1 1 ; 1 1 ; 4 9]); +assert_checkequal(a.root.D_set1.Data,z'); + +z = uint32(zeros(9,12)); +z(1:5,1) = uint32([1;21;41;61;81]); +h5dataset(a, "D_set2", [5 20 ; 1 1 ; 1 1 ; 1 1 ; 5 1], y, [9 12 ; 9 14 ; 1 1 ; 1 1 ; 1 1 ; 5 1]); +assert_checkequal(a.root.D_set2.Data,z'); + +msgerr = msprintf(gettext("%s: %s\n") + "%s: %s\n", "h5dataset", gettext("Cannot write data in the dataset."), gettext("HDF5 description"), "src and dest data spaces have different sizes."); +assert_checkerror("h5dataset(a, ""Dset_3"", [10 10 ; 2 1 ; 4 1 ; 2 1 ; 1 9], x, [10 10 ; 11 14 ; 3 3 ; 1 1 ; 1 1 ; 1 1])",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5dataset", gettext("Invalid target dataspace.")); +assert_checkerror("h5dataset(a, ""D_set4"", [10 10 ; 2 1 ; 4 1 ; 2 1 ; 1 9], x, [7 12 ; 6 11 ; 3 3 ; 1 1 ; 1 1 ; 4 9])",msgerr,999); + diff --git a/modules/hdf5/tests/unit_tests/h5exists.dia.ref b/modules/hdf5/tests/unit_tests/h5exists.dia.ref new file mode 100755 index 000000000..591b69dd4 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5exists.dia.ref @@ -0,0 +1,41 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5exists", 2, 3); +assert_checkerror("h5exists()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5exists", 2, 3); +assert_checkerror("h5exists(42)",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5exists", 1); +assert_checkerror("h5exists(42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5exists", 2); +assert_checkerror("h5exists(""42"",42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5exists", msprintf(gettext("Invalid hdf5 file: %s."), "42")); +assert_checkerror("h5exists(""42"",""42"")",msgerr,999); +x = 123; +y = 321; +save(TMPDIR + "/xy.sod", "x", "y"); +a = h5open(TMPDIR + "/xy.sod", "r"); +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5exists", 2, 3); +assert_checkerror("h5exists(a)",msgerr,77); +assert_checkfalse(h5exists(a,"42")); +b= [%T %T %F]; +assert_checkequal(h5exists(a, ["x" "y" "z"]),b); +assert_checkfalse(h5exists(a, "/tmp")); +assert_checktrue(h5exists(a, "/x")); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5exists", 2); +assert_checkerror("h5exists(a,a.root.x)",msgerr,999); +c = [%T %T]; +assert_checkequal(h5exists(a, "/", ["SCILAB_sod_version", "SCILAB_scilab_version"]),c); +assert_checktrue(h5exists(a, "/x", "SCILAB_Class")); +h5close(a); +assert_checkequal(h5exists(TMPDIR+"/xy.sod", ["x" "y" "z"]),b); +assert_checkfalse(h5exists(TMPDIR+"/xy.sod", "/tmp")); +assert_checktrue(h5exists(TMPDIR+"/xy.sod", "/x")); +c = [%T %T]; +assert_checkequal(h5exists(TMPDIR+"/xy.sod", "/", ["SCILAB_sod_version", "SCILAB_scilab_version"]),c); +assert_checktrue(h5exists(TMPDIR+"/xy.sod", "/x", "SCILAB_Class")); diff --git a/modules/hdf5/tests/unit_tests/h5exists.tst b/modules/hdf5/tests/unit_tests/h5exists.tst new file mode 100755 index 000000000..6d7ccabd7 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5exists.tst @@ -0,0 +1,46 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5exists", 2, 3); +assert_checkerror("h5exists()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5exists", 2, 3); +assert_checkerror("h5exists(42)",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5exists", 1); +assert_checkerror("h5exists(42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5exists", 2); +assert_checkerror("h5exists(""42"",42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5exists", msprintf(gettext("Invalid hdf5 file: %s."), "42")); +assert_checkerror("h5exists(""42"",""42"")",msgerr,999); + +x = 123; +y = 321; +save(TMPDIR + "/xy.sod", "x", "y"); +a = h5open(TMPDIR + "/xy.sod", "r"); + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5exists", 2, 3); +assert_checkerror("h5exists(a)",msgerr,77); +assert_checkfalse(h5exists(a,"42")); + +b= [%T %T %F]; +assert_checkequal(h5exists(a, ["x" "y" "z"]),b); +assert_checkfalse(h5exists(a, "/tmp")); +assert_checktrue(h5exists(a, "/x")); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5exists", 2); +assert_checkerror("h5exists(a,a.root.x)",msgerr,999); +c = [%T %T]; +assert_checkequal(h5exists(a, "/", ["SCILAB_sod_version", "SCILAB_scilab_version"]),c); +assert_checktrue(h5exists(a, "/x", "SCILAB_Class")); +h5close(a); + +assert_checkequal(h5exists(TMPDIR+"/xy.sod", ["x" "y" "z"]),b); +assert_checkfalse(h5exists(TMPDIR+"/xy.sod", "/tmp")); +assert_checktrue(h5exists(TMPDIR+"/xy.sod", "/x")); +c = [%T %T]; +assert_checkequal(h5exists(TMPDIR+"/xy.sod", "/", ["SCILAB_sod_version", "SCILAB_scilab_version"]),c); +assert_checktrue(h5exists(TMPDIR+"/xy.sod", "/x", "SCILAB_Class")); diff --git a/modules/hdf5/tests/unit_tests/h5flush.dia.ref b/modules/hdf5/tests/unit_tests/h5flush.dia.ref new file mode 100755 index 000000000..82166bf93 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5flush.dia.ref @@ -0,0 +1,30 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5flush", 1, 2); +assert_checkerror("h5flush()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A HDF5 object expected.\n"), "h5flush", 1); +assert_checkerror("h5flush(42)",msgerr,999); +a = h5open(TMPDIR + "/test.h5", "w"); +x = uint8(1:24); +h5dataset(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]); +assert_checkequal(h5ls(a,".","d"),["Dset1"]); +b = h5open(TMPDIR + "/test1.h5"); +h5group(a, "Grp_1"); +h5write(a.root.Grp_1, "Dset_1", [1 2 ; 3 4]); +h5flush(a); +h5group(b, "BGrp"); +h5write(b("/BGrp"), "BDset", 11:18); +h5close(b) +h5mv(a.root.Grp_1, "Dset_1", a, "Dset_2") +assert_checkequal(a.root.Datasets,["Dset1";"Dset_2"]); +assert_checkequal(a.root.Dset_2.data,[1 2;3 4]); +h5write(a.root.Grp_1, "Dset_1", [1 2 ; 3 4]); +h5flush(a); +h5mv(a.root.Grp_1, "Dset_1", a, "Dset_3") +assert_checkequal(a.root.Dset_3.data,[1 2;3 4]); diff --git a/modules/hdf5/tests/unit_tests/h5flush.tst b/modules/hdf5/tests/unit_tests/h5flush.tst new file mode 100755 index 000000000..fa3e97107 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5flush.tst @@ -0,0 +1,34 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5flush", 1, 2); +assert_checkerror("h5flush()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A HDF5 object expected.\n"), "h5flush", 1); +assert_checkerror("h5flush(42)",msgerr,999); + +a = h5open(TMPDIR + "/test.h5", "w"); +x = uint8(1:24); +h5dataset(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]); +assert_checkequal(h5ls(a,".","d"),["Dset1"]); + +b = h5open(TMPDIR + "/test1.h5"); +h5group(a, "Grp_1"); +h5write(a.root.Grp_1, "Dset_1", [1 2 ; 3 4]); +h5flush(a); +h5group(b, "BGrp"); +h5write(b("/BGrp"), "BDset", 11:18); +h5close(b) + +h5mv(a.root.Grp_1, "Dset_1", a, "Dset_2") +assert_checkequal(a.root.Datasets,["Dset1";"Dset_2"]); +assert_checkequal(a.root.Dset_2.data,[1 2;3 4]); +h5write(a.root.Grp_1, "Dset_1", [1 2 ; 3 4]); +h5flush(a); +h5mv(a.root.Grp_1, "Dset_1", a, "Dset_3") +assert_checkequal(a.root.Dset_3.data,[1 2;3 4]); diff --git a/modules/hdf5/tests/unit_tests/h5group.dia.ref b/modules/hdf5/tests/unit_tests/h5group.dia.ref new file mode 100755 index 000000000..77a76eccd --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5group.dia.ref @@ -0,0 +1,49 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5group", 2); +assert_checkerror("h5group()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5group", 2); +assert_checkerror("h5group(42)",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5group", 1); +assert_checkerror("h5group(42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5group", 2); +assert_checkerror("h5group(""42"",42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5group", msprintf(gettext("Invalid hdf5 file: %s."), "42")); +assert_checkerror("h5group(""42"",""42"")",msgerr,999); +a = h5open(TMPDIR + "/test_group.h5", "a"); +gnames = "Group_" + string(1:10); +sgnames = "SubGroup_" + string(1:10); +names = gnames; +for s=gnames + names = [names s + "/" + sgnames]; +end +h5group(a, names); +groups = cat(2,["Group_1" "Group_10"], "Group_"+string(2:9)); +assert_checkequal(a.root.Groups,groups'); +subgroups = cat(2,["SubGroup_1" "SubGroup_10"], "SubGroup_"+string(2:9)); +for i=groups + execstr("assert_checkequal(a.root."+i+".Groups,subgroups'')"); +end +h5close(a); +gnames2 = "Group_" + string(11:15); +sgnames2 = "SubGroup_" + string(11:15); +names2 = gnames2; +for s=gnames2 + names2 = [names2 s + "/" + sgnames2]; +end +h5group(TMPDIR+"/test_group.h5",names2); +a = h5open(TMPDIR + "/test_group.h5", "a"); +groups = cat(2,["Group_1"],"Group_"+string(10:15), "Group_"+string(2:9)); +partgroups = "Group_"+string(11:15); +assert_checkequal(a.root.Groups,groups'); +subgroups = "SubGroup_"+string(11:15); +for i=partgroups + execstr("assert_checkequal(a.root."+i+".Groups,subgroups'')"); +end +h5close(a); diff --git a/modules/hdf5/tests/unit_tests/h5group.tst b/modules/hdf5/tests/unit_tests/h5group.tst new file mode 100755 index 000000000..eac6627d1 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5group.tst @@ -0,0 +1,53 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5group", 2); +assert_checkerror("h5group()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5group", 2); +assert_checkerror("h5group(42)",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5group", 1); +assert_checkerror("h5group(42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5group", 2); +assert_checkerror("h5group(""42"",42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5group", msprintf(gettext("Invalid hdf5 file: %s."), "42")); +assert_checkerror("h5group(""42"",""42"")",msgerr,999); + +a = h5open(TMPDIR + "/test_group.h5", "a"); +gnames = "Group_" + string(1:10); +sgnames = "SubGroup_" + string(1:10); +names = gnames; +for s=gnames + names = [names s + "/" + sgnames]; +end +h5group(a, names); +groups = cat(2,["Group_1" "Group_10"], "Group_"+string(2:9)); +assert_checkequal(a.root.Groups,groups'); +subgroups = cat(2,["SubGroup_1" "SubGroup_10"], "SubGroup_"+string(2:9)); +for i=groups + execstr("assert_checkequal(a.root."+i+".Groups,subgroups'')"); +end + +h5close(a); + +gnames2 = "Group_" + string(11:15); +sgnames2 = "SubGroup_" + string(11:15); +names2 = gnames2; +for s=gnames2 + names2 = [names2 s + "/" + sgnames2]; +end +h5group(TMPDIR+"/test_group.h5",names2); +a = h5open(TMPDIR + "/test_group.h5", "a"); +groups = cat(2,["Group_1"],"Group_"+string(10:15), "Group_"+string(2:9)); +partgroups = "Group_"+string(11:15); +assert_checkequal(a.root.Groups,groups'); +subgroups = "SubGroup_"+string(11:15); +for i=partgroups + execstr("assert_checkequal(a.root."+i+".Groups,subgroups'')"); +end +h5close(a); diff --git a/modules/hdf5/tests/unit_tests/h5isAttr.dia.ref b/modules/hdf5/tests/unit_tests/h5isAttr.dia.ref new file mode 100755 index 000000000..dd862bdc0 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5isAttr.dia.ref @@ -0,0 +1,44 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5isAttr", 1); +assert_checkerror("h5isAttr()",msgerr,77); +assert_checkfalse(h5isAttr("42")); +assert_checkfalse(h5isAttr(42)); +w = "testing"; +x = 1:10; +y = [1 2;3 4]; +z = 1; +save(TMPDIR + "/w.sod", "w"); +save(TMPDIR + "/x.sod", "x"); +save(TMPDIR + "/y.sod", "y"); +save(TMPDIR + "/z.sod", "z"); +a = h5open(TMPDIR + "/w.sod", "r"); +assert_checkequal(h5isAttr(a),%F); +assert_checkequal(h5isAttr(a.root),%F); +assert_checkequal(h5isAttr(a.root.w),%F); +assert_checkequal(h5isAttr(a.root.SCILAB_scilab_version),%T); +h5close(a); +b = h5open(TMPDIR + "/x.sod", "r"); +assert_checkequal(h5isAttr(b),%F); +assert_checkequal(h5isAttr(b.root),%F); +assert_checkequal(h5isAttr(b.root.x),%F); +assert_checkequal(h5isAttr(b.root.SCILAB_scilab_version),%T); +h5close(b); +c = h5open(TMPDIR + "/y.sod", "r"); +assert_checkequal(h5isAttr(c),%F); +assert_checkequal(h5isAttr(c.root),%F); +assert_checkequal(h5isAttr(c.root.y),%F); +assert_checkequal(h5isAttr(c.root.SCILAB_scilab_version),%T); +h5close(c); +d = h5open(TMPDIR + "/z.sod", "r"); +assert_checkequal(h5isAttr(d),%F); +assert_checkequal(h5isAttr(d.root),%F); +assert_checkequal(h5isAttr(d.root.z),%F); +assert_checkequal(h5isAttr(d.root.SCILAB_scilab_version),%T); +h5close(d) diff --git a/modules/hdf5/tests/unit_tests/h5isAttr.tst b/modules/hdf5/tests/unit_tests/h5isAttr.tst new file mode 100755 index 000000000..8504ab537 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5isAttr.tst @@ -0,0 +1,50 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5isAttr", 1); +assert_checkerror("h5isAttr()",msgerr,77); +assert_checkfalse(h5isAttr("42")); +assert_checkfalse(h5isAttr(42)); + +w = "testing"; +x = 1:10; +y = [1 2;3 4]; +z = 1; +save(TMPDIR + "/w.sod", "w"); +save(TMPDIR + "/x.sod", "x"); +save(TMPDIR + "/y.sod", "y"); +save(TMPDIR + "/z.sod", "z"); + +a = h5open(TMPDIR + "/w.sod", "r"); +assert_checkequal(h5isAttr(a),%F); +assert_checkequal(h5isAttr(a.root),%F); +assert_checkequal(h5isAttr(a.root.w),%F); +assert_checkequal(h5isAttr(a.root.SCILAB_scilab_version),%T); +h5close(a); + +b = h5open(TMPDIR + "/x.sod", "r"); +assert_checkequal(h5isAttr(b),%F); +assert_checkequal(h5isAttr(b.root),%F); +assert_checkequal(h5isAttr(b.root.x),%F); +assert_checkequal(h5isAttr(b.root.SCILAB_scilab_version),%T); +h5close(b); + +c = h5open(TMPDIR + "/y.sod", "r"); +assert_checkequal(h5isAttr(c),%F); +assert_checkequal(h5isAttr(c.root),%F); +assert_checkequal(h5isAttr(c.root.y),%F); +assert_checkequal(h5isAttr(c.root.SCILAB_scilab_version),%T); +h5close(c); + +d = h5open(TMPDIR + "/z.sod", "r"); +assert_checkequal(h5isAttr(d),%F); +assert_checkequal(h5isAttr(d.root),%F); +assert_checkequal(h5isAttr(d.root.z),%F); +assert_checkequal(h5isAttr(d.root.SCILAB_scilab_version),%T); +h5close(d) diff --git a/modules/hdf5/tests/unit_tests/h5isFile.dia.ref b/modules/hdf5/tests/unit_tests/h5isFile.dia.ref new file mode 100755 index 000000000..099939847 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5isFile.dia.ref @@ -0,0 +1,40 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5isFile", 1); +assert_checkerror("h5isFile()",msgerr,77); +assert_checkfalse(h5isFile("42")); +assert_checkfalse(h5isFile(42)); +w = "testing"; +x = 1:10; +y = [1 2;3 4]; +z = 1; +save(TMPDIR + "/w.sod", "w"); +save(TMPDIR + "/x.sod", "x"); +save(TMPDIR + "/y.sod", "y"); +save(TMPDIR + "/z.sod", "z"); +a = h5open(TMPDIR + "/w.sod", "r"); +assert_checkequal(h5isFile(a),%T); +assert_checkequal(h5isFile(a.root),%F); +assert_checkequal(h5isFile(a.root.w),%F); +h5close(a); +b = h5open(TMPDIR + "/x.sod", "r"); +assert_checkequal(h5isFile(b),%T); +assert_checkequal(h5isFile(b.root),%F); +assert_checkequal(h5isFile(b.root.x),%F); +h5close(a); +c = h5open(TMPDIR + "/y.sod", "r"); +assert_checkequal(h5isFile(c),%T); +assert_checkequal(h5isFile(c.root),%F); +assert_checkequal(h5isFile(c.root.y),%F); +h5close(c); +d = h5open(TMPDIR + "/z.sod", "r"); +assert_checkequal(h5isFile(d),%T); +assert_checkequal(h5isFile(d.root),%F); +assert_checkequal(h5isFile(d.root.z),%F); +h5close(d); diff --git a/modules/hdf5/tests/unit_tests/h5isFile.tst b/modules/hdf5/tests/unit_tests/h5isFile.tst new file mode 100755 index 000000000..a59210b20 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5isFile.tst @@ -0,0 +1,46 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5isFile", 1); +assert_checkerror("h5isFile()",msgerr,77); +assert_checkfalse(h5isFile("42")); +assert_checkfalse(h5isFile(42)); + +w = "testing"; +x = 1:10; +y = [1 2;3 4]; +z = 1; +save(TMPDIR + "/w.sod", "w"); +save(TMPDIR + "/x.sod", "x"); +save(TMPDIR + "/y.sod", "y"); +save(TMPDIR + "/z.sod", "z"); + +a = h5open(TMPDIR + "/w.sod", "r"); +assert_checkequal(h5isFile(a),%T); +assert_checkequal(h5isFile(a.root),%F); +assert_checkequal(h5isFile(a.root.w),%F); +h5close(a); + +b = h5open(TMPDIR + "/x.sod", "r"); +assert_checkequal(h5isFile(b),%T); +assert_checkequal(h5isFile(b.root),%F); +assert_checkequal(h5isFile(b.root.x),%F); +h5close(a); + +c = h5open(TMPDIR + "/y.sod", "r"); +assert_checkequal(h5isFile(c),%T); +assert_checkequal(h5isFile(c.root),%F); +assert_checkequal(h5isFile(c.root.y),%F); +h5close(c); + +d = h5open(TMPDIR + "/z.sod", "r"); +assert_checkequal(h5isFile(d),%T); +assert_checkequal(h5isFile(d.root),%F); +assert_checkequal(h5isFile(d.root.z),%F); +h5close(d); diff --git a/modules/hdf5/tests/unit_tests/h5isGroup.dia.ref b/modules/hdf5/tests/unit_tests/h5isGroup.dia.ref new file mode 100755 index 000000000..680157c9c --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5isGroup.dia.ref @@ -0,0 +1,32 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +// +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5isGroup", 1); +assert_checkerror("h5isGroup()",msgerr,77); +assert_checkfalse(h5isGroup("42")); +assert_checkfalse(h5isGroup(42)); +w = "testing"; +x = list(1, "hello"); +y = [1 2;3 4]; +z = 1; +save(TMPDIR + "/w.sod", "w"); +save(TMPDIR + "/x.sod", "x"); +save(TMPDIR + "/y.sod", "y"); +save(TMPDIR + "/z.sod", "z"); +a = h5open(TMPDIR + "/w.sod", "r"); +assert_checkequal(h5isGroup(a),%F); +assert_checkequal(h5isGroup(a.root),%T); +assert_checkequal(h5isGroup(a.root.w),%F); +assert_checkequal(h5isGroup(a.root.w.type),%F); +h5close(a); +b = h5open(TMPDIR + "/x.sod", "r"); +assert_checkequal(h5isGroup(b),%F); +assert_checkequal(h5isGroup(b.root),%T); +assert_checkequal(h5isGroup(b.root.x),%F); +assert_checkequal(h5isGroup(b.root.x.type),%F); +h5close(b); diff --git a/modules/hdf5/tests/unit_tests/h5isGroup.tst b/modules/hdf5/tests/unit_tests/h5isGroup.tst new file mode 100755 index 000000000..081a9dfab --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5isGroup.tst @@ -0,0 +1,38 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +// + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5isGroup", 1); +assert_checkerror("h5isGroup()",msgerr,77); +assert_checkfalse(h5isGroup("42")); +assert_checkfalse(h5isGroup(42)); + +w = "testing"; +x = list(1, "hello"); +y = [1 2;3 4]; +z = 1; +save(TMPDIR + "/w.sod", "w"); +save(TMPDIR + "/x.sod", "x"); +save(TMPDIR + "/y.sod", "y"); +save(TMPDIR + "/z.sod", "z"); + +a = h5open(TMPDIR + "/w.sod", "r"); +assert_checkequal(h5isGroup(a),%F); +assert_checkequal(h5isGroup(a.root),%T); +assert_checkequal(h5isGroup(a.root.w),%F); +assert_checkequal(h5isGroup(a.root.w.type),%F); +h5close(a); + +b = h5open(TMPDIR + "/x.sod", "r"); +assert_checkequal(h5isGroup(b),%F); +assert_checkequal(h5isGroup(b.root),%T); +assert_checkequal(h5isGroup(b.root.x),%F); +assert_checkequal(h5isGroup(b.root.x.type),%F); +h5close(b); + + diff --git a/modules/hdf5/tests/unit_tests/h5isRef.dia.ref b/modules/hdf5/tests/unit_tests/h5isRef.dia.ref new file mode 100755 index 000000000..e9dddf255 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5isRef.dia.ref @@ -0,0 +1,40 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5isRef", 1); +assert_checkerror("h5isRef()",msgerr,77); +assert_checkfalse(h5isRef("42")); +assert_checkfalse(h5isRef(42)); +w = "testing"; +x = list(1, "hello"); +y = [1 2;3 4]; +z = 1; +save(TMPDIR + "/w.sod", "w"); +save(TMPDIR + "/x.sod", "x"); +save(TMPDIR + "/y.sod", "y"); +save(TMPDIR + "/z.sod", "z"); +a = h5open(TMPDIR + "/w.sod", "r"); +assert_checkfalse(h5isRef(a)); +aw = a.root.w.data; +assert_checkfalse(h5isRef(aw)); +h5close(a) +b = h5open(TMPDIR + "/x.sod", "r"); +assert_checkfalse(h5isRef(b)); +bx = b.root.x.data; +assert_checktrue(h5isRef(bx)); +h5close(b) +c = h5open(TMPDIR + "/y.sod", "r"); +assert_checkfalse(h5isRef(c)); +cy = c.root.y.data; +assert_checkfalse(h5isRef(cy)); +h5close(c) +d = h5open(TMPDIR + "/z.sod", "r"); +assert_checkfalse(h5isRef(d)); +dz = d.root.z.data; +assert_checkfalse(h5isRef(dz)); +h5close(d) diff --git a/modules/hdf5/tests/unit_tests/h5isRef.tst b/modules/hdf5/tests/unit_tests/h5isRef.tst new file mode 100755 index 000000000..b4b32ca03 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5isRef.tst @@ -0,0 +1,47 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5isRef", 1); +assert_checkerror("h5isRef()",msgerr,77); +assert_checkfalse(h5isRef("42")); +assert_checkfalse(h5isRef(42)); + +w = "testing"; +x = list(1, "hello"); +y = [1 2;3 4]; +z = 1; +save(TMPDIR + "/w.sod", "w"); +save(TMPDIR + "/x.sod", "x"); +save(TMPDIR + "/y.sod", "y"); +save(TMPDIR + "/z.sod", "z"); + +a = h5open(TMPDIR + "/w.sod", "r"); +assert_checkfalse(h5isRef(a)); +aw = a.root.w.data; +assert_checkfalse(h5isRef(aw)); +h5close(a) + +b = h5open(TMPDIR + "/x.sod", "r"); +assert_checkfalse(h5isRef(b)); +bx = b.root.x.data; +assert_checktrue(h5isRef(bx)); +h5close(b) + +c = h5open(TMPDIR + "/y.sod", "r"); +assert_checkfalse(h5isRef(c)); +cy = c.root.y.data; +assert_checkfalse(h5isRef(cy)); +h5close(c) + +d = h5open(TMPDIR + "/z.sod", "r"); +assert_checkfalse(h5isRef(d)); +dz = d.root.z.data; +assert_checkfalse(h5isRef(dz)); +h5close(d) + diff --git a/modules/hdf5/tests/unit_tests/h5isSet.dia.ref b/modules/hdf5/tests/unit_tests/h5isSet.dia.ref new file mode 100755 index 000000000..95ac42eaf --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5isSet.dia.ref @@ -0,0 +1,37 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5isSet", 1); +assert_checkerror("h5isSet()",msgerr,77); +assert_checkfalse(h5isSet("42")); +assert_checkfalse(h5isSet(42)); +w = "testing"; +x = 1:10; +y = [1 2;3 4]; +z = 1; +save(TMPDIR + "/w.sod", "w"); +save(TMPDIR + "/x.sod", "x"); +save(TMPDIR + "/y.sod", "y"); +save(TMPDIR + "/z.sod", "z"); +a = h5open(TMPDIR + "/w.sod", "r"); +assert_checkfalse(h5isSet(a)); +assert_checktrue(h5isSet(a.root.w)); +h5close(a); +b = h5open(TMPDIR + "/x.sod", "r"); +assert_checkfalse(h5isSet(b)); +assert_checktrue(h5isSet(b.root.x)); +h5close(b); +c = h5open(TMPDIR + "/y.sod","r"); +assert_checkfalse(h5isSet(c)); +assert_checkfalse(h5isSet(c.root)); +assert_checktrue(h5isSet(c.root.y)); +h5close(c); +d = h5open(TMPDIR + "/z.sod","r"); +assert_checkfalse(h5isSet(d)); +assert_checktrue(h5isSet(d.root.z)); +h5close(d); diff --git a/modules/hdf5/tests/unit_tests/h5isSet.tst b/modules/hdf5/tests/unit_tests/h5isSet.tst new file mode 100755 index 000000000..64d83aa5b --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5isSet.tst @@ -0,0 +1,43 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5isSet", 1); +assert_checkerror("h5isSet()",msgerr,77); +assert_checkfalse(h5isSet("42")); +assert_checkfalse(h5isSet(42)); + +w = "testing"; +x = 1:10; +y = [1 2;3 4]; +z = 1; +save(TMPDIR + "/w.sod", "w"); +save(TMPDIR + "/x.sod", "x"); +save(TMPDIR + "/y.sod", "y"); +save(TMPDIR + "/z.sod", "z"); + +a = h5open(TMPDIR + "/w.sod", "r"); +assert_checkfalse(h5isSet(a)); +assert_checktrue(h5isSet(a.root.w)); +h5close(a); + +b = h5open(TMPDIR + "/x.sod", "r"); +assert_checkfalse(h5isSet(b)); +assert_checktrue(h5isSet(b.root.x)); +h5close(b); + +c = h5open(TMPDIR + "/y.sod","r"); +assert_checkfalse(h5isSet(c)); +assert_checkfalse(h5isSet(c.root)); +assert_checktrue(h5isSet(c.root.y)); +h5close(c); + +d = h5open(TMPDIR + "/z.sod","r"); +assert_checkfalse(h5isSet(d)); +assert_checktrue(h5isSet(d.root.z)); +h5close(d); diff --git a/modules/hdf5/tests/unit_tests/h5isSpace.dia.ref b/modules/hdf5/tests/unit_tests/h5isSpace.dia.ref new file mode 100755 index 000000000..ad2cac8ba --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5isSpace.dia.ref @@ -0,0 +1,44 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5isSpace", 1); +assert_checkerror("h5isSpace()",msgerr,77); +assert_checkfalse(h5isSpace(42)); +assert_checkfalse(h5isSpace("42")); +w = "testing"; +x = 1:10; +y = [1 2;3 4]; +z = 1; +save(TMPDIR + "/w.sod", "w"); +save(TMPDIR + "/x.sod", "x"); +save(TMPDIR + "/y.sod", "y"); +save(TMPDIR + "/z.sod", "z"); +a = h5open(TMPDIR + "/w.sod", "r"); +assert_checkfalse(h5isSpace(a)); +assert_checkfalse(h5isSpace(a.root)); +assert_checkfalse(h5isSpace(a.root.w)); +assert_checktrue(h5isSpace(a.root.w.dataspace)); +h5close(a); +b = h5open(TMPDIR + "/x.sod", "r"); +assert_checkfalse(h5isSpace(b)); +assert_checkfalse(h5isSpace(b.root)); +assert_checkfalse(h5isSpace(b.root.x)); +assert_checktrue(h5isSpace(b.root.x.dataspace)); +h5close(b); +c = h5open(TMPDIR + "/y.sod", "r"); +assert_checkfalse(h5isSpace(c)); +assert_checkfalse(h5isSpace(c.root)); +assert_checkfalse(h5isSpace(c.root.y)); +assert_checktrue(h5isSpace(c.root.y.dataspace)); +h5close(c); +d = h5open(TMPDIR + "/z.sod", "r"); +assert_checkfalse(h5isSpace(d)); +assert_checkfalse(h5isSpace(d.root)); +assert_checkfalse(h5isSpace(d.root.z)); +assert_checktrue(h5isSpace(d.root.z.dataspace)); +h5close(d); diff --git a/modules/hdf5/tests/unit_tests/h5isSpace.tst b/modules/hdf5/tests/unit_tests/h5isSpace.tst new file mode 100755 index 000000000..b589cd6d1 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5isSpace.tst @@ -0,0 +1,50 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5isSpace", 1); +assert_checkerror("h5isSpace()",msgerr,77); +assert_checkfalse(h5isSpace(42)); +assert_checkfalse(h5isSpace("42")); + +w = "testing"; +x = 1:10; +y = [1 2;3 4]; +z = 1; +save(TMPDIR + "/w.sod", "w"); +save(TMPDIR + "/x.sod", "x"); +save(TMPDIR + "/y.sod", "y"); +save(TMPDIR + "/z.sod", "z"); + +a = h5open(TMPDIR + "/w.sod", "r"); +assert_checkfalse(h5isSpace(a)); +assert_checkfalse(h5isSpace(a.root)); +assert_checkfalse(h5isSpace(a.root.w)); +assert_checktrue(h5isSpace(a.root.w.dataspace)); +h5close(a); + +b = h5open(TMPDIR + "/x.sod", "r"); +assert_checkfalse(h5isSpace(b)); +assert_checkfalse(h5isSpace(b.root)); +assert_checkfalse(h5isSpace(b.root.x)); +assert_checktrue(h5isSpace(b.root.x.dataspace)); +h5close(b); + +c = h5open(TMPDIR + "/y.sod", "r"); +assert_checkfalse(h5isSpace(c)); +assert_checkfalse(h5isSpace(c.root)); +assert_checkfalse(h5isSpace(c.root.y)); +assert_checktrue(h5isSpace(c.root.y.dataspace)); +h5close(c); + +d = h5open(TMPDIR + "/z.sod", "r"); +assert_checkfalse(h5isSpace(d)); +assert_checkfalse(h5isSpace(d.root)); +assert_checkfalse(h5isSpace(d.root.z)); +assert_checktrue(h5isSpace(d.root.z.dataspace)); +h5close(d); diff --git a/modules/hdf5/tests/unit_tests/h5isType.dia.ref b/modules/hdf5/tests/unit_tests/h5isType.dia.ref new file mode 100755 index 000000000..b54439f08 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5isType.dia.ref @@ -0,0 +1,44 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5isType", 1); +assert_checkerror("h5isType()",msgerr,77); +assert_checkfalse(h5isType("42")); +assert_checkfalse(h5isType(42)); +w = "testing"; +x = list(1, "hello"); +y = [1 2;3 4]; +z = 1; +save(TMPDIR + "/w.sod", "w"); +save(TMPDIR + "/x.sod", "x"); +save(TMPDIR + "/y.sod", "y"); +save(TMPDIR + "/z.sod", "z"); +a = h5open(TMPDIR + "/w.sod", "r"); +assert_checkfalse(h5isType(a)); +assert_checkfalse(h5isType(a.root)); +assert_checkfalse(h5isType(a.root.w)); +assert_checktrue(h5isType(a.root.w.type)); +h5close(a) +b = h5open(TMPDIR + "/x.sod", "r"); +assert_checkfalse(h5isType(b)); +assert_checkfalse(h5isType(b.root)); +assert_checkfalse(h5isType(b.root.x)); +assert_checktrue(h5isType(b.root.x.type)); +h5close(b) +c = h5open(TMPDIR + "/y.sod", "r"); +assert_checkfalse(h5isType(c)); +assert_checkfalse(h5isType(c.root)); +assert_checkfalse(h5isType(c.root.y)); +assert_checktrue(h5isType(c.root.y.type)); +h5close(c) +d = h5open(TMPDIR + "/z.sod", "r"); +assert_checkfalse(h5isType(d)); +assert_checkfalse(h5isType(d.root)); +assert_checkfalse(h5isType(d.root.z)); +assert_checktrue(h5isType(d.root.z.type)); +h5close(d) diff --git a/modules/hdf5/tests/unit_tests/h5isType.tst b/modules/hdf5/tests/unit_tests/h5isType.tst new file mode 100755 index 000000000..1bb9aa457 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5isType.tst @@ -0,0 +1,50 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5isType", 1); +assert_checkerror("h5isType()",msgerr,77); +assert_checkfalse(h5isType("42")); +assert_checkfalse(h5isType(42)); + +w = "testing"; +x = list(1, "hello"); +y = [1 2;3 4]; +z = 1; +save(TMPDIR + "/w.sod", "w"); +save(TMPDIR + "/x.sod", "x"); +save(TMPDIR + "/y.sod", "y"); +save(TMPDIR + "/z.sod", "z"); + +a = h5open(TMPDIR + "/w.sod", "r"); +assert_checkfalse(h5isType(a)); +assert_checkfalse(h5isType(a.root)); +assert_checkfalse(h5isType(a.root.w)); +assert_checktrue(h5isType(a.root.w.type)); +h5close(a) + +b = h5open(TMPDIR + "/x.sod", "r"); +assert_checkfalse(h5isType(b)); +assert_checkfalse(h5isType(b.root)); +assert_checkfalse(h5isType(b.root.x)); +assert_checktrue(h5isType(b.root.x.type)); +h5close(b) + +c = h5open(TMPDIR + "/y.sod", "r"); +assert_checkfalse(h5isType(c)); +assert_checkfalse(h5isType(c.root)); +assert_checkfalse(h5isType(c.root.y)); +assert_checktrue(h5isType(c.root.y.type)); +h5close(c) + +d = h5open(TMPDIR + "/z.sod", "r"); +assert_checkfalse(h5isType(d)); +assert_checkfalse(h5isType(d.root)); +assert_checkfalse(h5isType(d.root.z)); +assert_checktrue(h5isType(d.root.z.type)); +h5close(d) diff --git a/modules/hdf5/tests/unit_tests/h5label.dia.ref b/modules/hdf5/tests/unit_tests/h5label.dia.ref new file mode 100755 index 000000000..b2fbcacae --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5label.dia.ref @@ -0,0 +1,28 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5label", 4); +assert_checkerror("h5label()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5label", 4); +assert_checkerror("h5label(42)",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string or a H5Object expected.\n"), "h5label", 1); +assert_checkerror("h5label(42,42,42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5label", 2); +assert_checkerror("h5label(""42"",42,42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: Row array of strings expected.\n"), "h5label", 4); +assert_checkerror("h5label(""42"",""42"",42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5label", msprintf(gettext("Invalid hdf5 file: %s."), "42")); +assert_checkerror("h5label(""42"",""42"",42,[""42""])",msgerr,999); +a = h5open(TMPDIR + "/test.h5", "w"); +msgerr = msprintf(gettext("%s: %s\n"), "h5label", msprintf(gettext("Invalid name: %s.") ,"42")); +assert_checkerror("h5label(a,""42"",42,[""42""])",msgerr,999); +x = uint8(1:24); +h5dataset(a, "Dset_1", [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]); +h5label(a, "Dset_1", [1 3], ["Hello" "World"]); +assert_checkequal(a.root.Dset_1.DIMENSION_LABELS.data,["Hello" "" "World" ""]); +h5close(a) diff --git a/modules/hdf5/tests/unit_tests/h5label.tst b/modules/hdf5/tests/unit_tests/h5label.tst new file mode 100755 index 000000000..870d97a4b --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5label.tst @@ -0,0 +1,31 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5label", 4); +assert_checkerror("h5label()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5label", 4); +assert_checkerror("h5label(42)",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string or a H5Object expected.\n"), "h5label", 1); +assert_checkerror("h5label(42,42,42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5label", 2); +assert_checkerror("h5label(""42"",42,42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: Row array of strings expected.\n"), "h5label", 4); +assert_checkerror("h5label(""42"",""42"",42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5label", msprintf(gettext("Invalid hdf5 file: %s."), "42")); +assert_checkerror("h5label(""42"",""42"",42,[""42""])",msgerr,999); + +a = h5open(TMPDIR + "/test.h5", "w"); +msgerr = msprintf(gettext("%s: %s\n"), "h5label", msprintf(gettext("Invalid name: %s.") ,"42")); +assert_checkerror("h5label(a,""42"",42,[""42""])",msgerr,999); + +x = uint8(1:24); +h5dataset(a, "Dset_1", [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]); +h5label(a, "Dset_1", [1 3], ["Hello" "World"]); +assert_checkequal(a.root.Dset_1.DIMENSION_LABELS.data,["Hello" "" "World" ""]); +h5close(a) diff --git a/modules/hdf5/tests/unit_tests/h5ln.dia.ref b/modules/hdf5/tests/unit_tests/h5ln.dia.ref new file mode 100755 index 000000000..94a3fdf67 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5ln.dia.ref @@ -0,0 +1,52 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5ln", 3, 5); +assert_checkerror("h5ln()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5ln", 1); +assert_checkerror("h5ln(42,42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5ln", 2); +assert_checkerror("h5ln(""42"",42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5ln", 3); +assert_checkerror("h5ln(""42"",""42"",42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5ln", msprintf(gettext("Invalid hdf5 file: %s."), "42")); +assert_checkerror("h5ln(""42"",""42"",""42"")",msgerr,999); +a = h5open(TMPDIR + "/test.h5"); +h5ln(a,"42","42"); +msgerr = msprintf(gettext("%s: Error in retrieving field content:\n%s\n"), "%H5Object_e", msprintf(gettext("Invalid name: %s."), "/42")); +msgerr($+1) = gettext("HDF5 description") + ": " + "too many links."; +assert_checkerror("a(""/42"")",msgerr,999); +h5rm(a,"/42"); +b = h5open(TMPDIR + "/test1.h5"); +h5group(a, "Grp_1"); +h5write(a.root.Grp_1, "Dset_1", [1 2 ; 3 4]); +h5group(a, "Grp_3"); +h5write(a.root.Grp_3, "Dset_3", [16 32; 42 84]); +h5group(b, "BGrp"); +h5write(b("/BGrp"), "BDset", 11:18); +h5group(b, "BGrp_2"); +h5write(b("/BGrp_2"), "BDset_2", 8:12); +h5close(b) +h5group(a, "Grp_2"); +h5ln(a, "Hard_Link", "/Grp_1/Dset_1", %t) +assert_checkequal(a.root.Datasets,"Hard_Link"); +h5ln(a, "Soft_Link", "/Grp_1/Dset_1") +assert_checkequal(a.root.Softs,"Soft_Link"); +assert_checkequal(a.root.Datasets,["Hard_Link";"Soft_Link"]); +h5ln(a, "External_Link", TMPDIR +"/test1.h5", "/BGrp"); +assert_checkequal(a.root.Externals,"External_Link"); +h5ln(a, "External_Link2", TMPDIR +"/test1.h5", "/BGrp/BDset"); +assert_checkequal(a.root.Datasets,["Hard_Link";"Soft_Link";"External_Link2"]); +h5rm(a,'/Grp_1/Dset_1'); +assert_checkequal(a.root.Datasets,["Hard_Link";"External_Link2"]); +assert_checkequal(a.root.Softs,["Soft_Link"]); +msgerr = msprintf(gettext("%s: Error in retrieving field content:\n%s\n"), "%H5Object_e", msprintf(gettext("Invalid field: %s"), "Soft_Link")); +assert_checkerror("a.root.Soft_Link",msgerr,999); +h5rm(a,'/Hard_Link'); +assert_checkequal(a.root.Datasets,["External_Link2"]); +h5close(a); diff --git a/modules/hdf5/tests/unit_tests/h5ln.tst b/modules/hdf5/tests/unit_tests/h5ln.tst new file mode 100755 index 000000000..94bc42447 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5ln.tst @@ -0,0 +1,60 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5ln", 3, 5); +assert_checkerror("h5ln()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5ln", 1); +assert_checkerror("h5ln(42,42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5ln", 2); +assert_checkerror("h5ln(""42"",42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5ln", 3); +assert_checkerror("h5ln(""42"",""42"",42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5ln", msprintf(gettext("Invalid hdf5 file: %s."), "42")); +assert_checkerror("h5ln(""42"",""42"",""42"")",msgerr,999); + +a = h5open(TMPDIR + "/test.h5"); +h5ln(a,"42","42"); +msgerr = msprintf(gettext("%s: Error in retrieving field content:\n%s\n"), "%H5Object_e", msprintf(gettext("Invalid name: %s."), "/42")); +msgerr($+1) = gettext("HDF5 description") + ": " + "too many links."; +assert_checkerror("a(""/42"")",msgerr,999); +h5rm(a,"/42"); + +b = h5open(TMPDIR + "/test1.h5"); + +h5group(a, "Grp_1"); +h5write(a.root.Grp_1, "Dset_1", [1 2 ; 3 4]); +h5group(a, "Grp_3"); +h5write(a.root.Grp_3, "Dset_3", [16 32; 42 84]); +h5group(b, "BGrp"); +h5write(b("/BGrp"), "BDset", 11:18); +h5group(b, "BGrp_2"); +h5write(b("/BGrp_2"), "BDset_2", 8:12); + +h5close(b) + +h5group(a, "Grp_2"); +h5ln(a, "Hard_Link", "/Grp_1/Dset_1", %t) +assert_checkequal(a.root.Datasets,"Hard_Link"); +h5ln(a, "Soft_Link", "/Grp_1/Dset_1") +assert_checkequal(a.root.Softs,"Soft_Link"); +assert_checkequal(a.root.Datasets,["Hard_Link";"Soft_Link"]); +h5ln(a, "External_Link", TMPDIR +"/test1.h5", "/BGrp"); +assert_checkequal(a.root.Externals,"External_Link"); +h5ln(a, "External_Link2", TMPDIR +"/test1.h5", "/BGrp/BDset"); +assert_checkequal(a.root.Datasets,["Hard_Link";"Soft_Link";"External_Link2"]); + +h5rm(a,'/Grp_1/Dset_1'); +assert_checkequal(a.root.Datasets,["Hard_Link";"External_Link2"]); +assert_checkequal(a.root.Softs,["Soft_Link"]); +msgerr = msprintf(gettext("%s: Error in retrieving field content:\n%s\n"), "%H5Object_e", msprintf(gettext("Invalid field: %s"), "Soft_Link")); +assert_checkerror("a.root.Soft_Link",msgerr,999); +h5rm(a,'/Hard_Link'); +assert_checkequal(a.root.Datasets,["External_Link2"]); + +h5close(a); diff --git a/modules/hdf5/tests/unit_tests/h5ls.dia.ref b/modules/hdf5/tests/unit_tests/h5ls.dia.ref new file mode 100755 index 000000000..5044f6df9 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5ls.dia.ref @@ -0,0 +1,48 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5ls", 1, 3); +assert_checkerror("h5ls()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5ls", 1); +assert_checkerror("h5ls(42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5ls", msprintf(gettext("Invalid hdf5 file: %s."), "42")); +assert_checkerror("h5ls(""42"")",msgerr,999); +x = int8(matrix(1:80, 10, 8)); +save(TMPDIR + "/x.sod", "x"); +msgerr = msprintf(gettext("%s: %s\n"), "h5ls", msprintf(gettext("Invalid hdf5 file: %s."), "x")); +assert_checkerror("h5ls(""x"")",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5ls", 2); +assert_checkerror("h5ls(TMPDIR+""/x.sod"",12.0)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5ls", 3); +assert_checkerror("h5ls(TMPDIR+""/x.sod"",""."",12.0)",msgerr,999); +a = h5open(TMPDIR + "/x.sod"); +dset = ["x" "dataset"]; +attr = ["SCILAB_scilab_version" "attribute";"SCILAB_sod_version" "attribute"]; +assert_checkequal(h5ls(a),cat(1,dset,attr)); +attr = ["SCILAB_Class" "attribute";"SCILAB_precision" "attribute"]; +assert_checkequal(h5ls(a.root.x),attr); +assert_checkequal(h5ls(a,"/x"),attr); +attr = ["SCILAB_scilab_version";"SCILAB_sod_version"]; +assert_checkequal(h5ls(a,".","a"),attr); +msgerr = msprintf(gettext("%s: %s\n"), "h5ls", gettext("Invalid filter")); +assert_checkerror("h5ls(a,""."",""x"")",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5ls", 1); +assert_checkerror("h5ls(12.0)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5ls", 2); +assert_checkerror("h5ls(a,12.0)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5ls", 3); +assert_checkerror("h5ls(a,""."",12.0)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5ls", msprintf(gettext("Invalid hdf5 file: %s."), "x")); +assert_checkerror("h5ls(""x"")",msgerr,999); +h5close(a); +attr = ["SCILAB_scilab_version" "attribute";"SCILAB_sod_version" "attribute"]; +assert_checkequal(h5ls(TMPDIR+"/x.sod"),cat(1,dset,attr)); +attr = ["SCILAB_Class" "attribute";"SCILAB_precision" "attribute"]; +assert_checkequal(h5ls(TMPDIR+"/x.sod","/x"),attr); +attr = ["SCILAB_scilab_version";"SCILAB_sod_version"]; +assert_checkequal(h5ls(TMPDIR+"/x.sod",".","a"),attr); diff --git a/modules/hdf5/tests/unit_tests/h5ls.tst b/modules/hdf5/tests/unit_tests/h5ls.tst new file mode 100755 index 000000000..e2cf0807f --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5ls.tst @@ -0,0 +1,62 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5ls", 1, 3); +assert_checkerror("h5ls()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5ls", 1); +assert_checkerror("h5ls(42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5ls", msprintf(gettext("Invalid hdf5 file: %s."), "42")); +assert_checkerror("h5ls(""42"")",msgerr,999); + +x = int8(matrix(1:80, 10, 8)); +save(TMPDIR + "/x.sod", "x"); + + +msgerr = msprintf(gettext("%s: %s\n"), "h5ls", msprintf(gettext("Invalid hdf5 file: %s."), "x")); +assert_checkerror("h5ls(""x"")",msgerr,999); + +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5ls", 2); +assert_checkerror("h5ls(TMPDIR+""/x.sod"",12.0)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5ls", 3); +assert_checkerror("h5ls(TMPDIR+""/x.sod"",""."",12.0)",msgerr,999); + +a = h5open(TMPDIR + "/x.sod"); +dset = ["x" "dataset"]; +attr = ["SCILAB_scilab_version" "attribute";"SCILAB_sod_version" "attribute"]; +assert_checkequal(h5ls(a),cat(1,dset,attr)); +attr = ["SCILAB_Class" "attribute";"SCILAB_precision" "attribute"]; +assert_checkequal(h5ls(a.root.x),attr); +assert_checkequal(h5ls(a,"/x"),attr); + +attr = ["SCILAB_scilab_version";"SCILAB_sod_version"]; +assert_checkequal(h5ls(a,".","a"),attr); + +msgerr = msprintf(gettext("%s: %s\n"), "h5ls", gettext("Invalid filter")); +assert_checkerror("h5ls(a,""."",""x"")",msgerr,999); + +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5ls", 1); +assert_checkerror("h5ls(12.0)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5ls", 2); +assert_checkerror("h5ls(a,12.0)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5ls", 3); +assert_checkerror("h5ls(a,""."",12.0)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5ls", msprintf(gettext("Invalid hdf5 file: %s."), "x")); +assert_checkerror("h5ls(""x"")",msgerr,999); + +h5close(a); + +attr = ["SCILAB_scilab_version" "attribute";"SCILAB_sod_version" "attribute"]; +assert_checkequal(h5ls(TMPDIR+"/x.sod"),cat(1,dset,attr)); +attr = ["SCILAB_Class" "attribute";"SCILAB_precision" "attribute"]; +assert_checkequal(h5ls(TMPDIR+"/x.sod","/x"),attr); +attr = ["SCILAB_scilab_version";"SCILAB_sod_version"]; +assert_checkequal(h5ls(TMPDIR+"/x.sod",".","a"),attr); + + + diff --git a/modules/hdf5/tests/unit_tests/h5mount.dia.ref b/modules/hdf5/tests/unit_tests/h5mount.dia.ref new file mode 100755 index 000000000..97964eac9 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5mount.dia.ref @@ -0,0 +1,46 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5mount", 3); +assert_checkerror("h5mount()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5mount", 3); +assert_checkerror("h5mount(42)",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A H5Object expected.\n"), "h5mount", 1); +assert_checkerror("h5mount(42,42,42)",msgerr,999); +a = h5open(TMPDIR + "/test.h5", "w"); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A H5Object expected.\n"), "h5mount", 3); +assert_checkerror("h5mount(a,""42"",42)",msgerr,999); +h5group(a, "/mnt"); +b = h5open(TMPDIR + "/test1.h5", "w"); +h5group(b, "Group_1"); +h5write(b, "Group_1/Dataset_1", uint32([1 2;3 4])); +c = h5open(TMPDIR + "/test2.h5", "w"); +h5group(c, "Group_2"); +h5write(c, "Group_2/Dataset_2", uint32([14 15 16;17 18 19])); +h5mount(a, "/mnt", b); +assert_checkequal(a.root.mnt.Groups,"Group_1"); +msgerr = msprintf(gettext("%s: %s\n"), "h5mount", msprintf(gettext("Cannot mount the file: %s"), TMPDIR + filesep() + "test1.h5")); +msgerr($+1) = gettext("HDF5 description") + ": " + "file is already mounted."; +assert_checkerror("h5mount(a, ""/mnt"", b)",msgerr,999); +h5mount(a, "/mnt", c); +assert_checkequal(a.root.mnt.Groups,"Group_2"); +msgerr = msprintf(gettext("%s: %s\n"), "h5mount", msprintf(gettext("Invalid location: %s"),"/test")); +assert_checkerror("h5mount(a,""/test"",c)",msgerr,999); +msgerr = msprintf(gettext("%s: Error in retrieving field content:\n%s\n"), "%H5Object_e", msprintf(gettext("Invalid field: %s"), "Group_1")); +assert_checkerror("h5write(a.root.mnt.Group_1, ""Dataset_1"", uint32([10 11;12 13]))",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5write", gettext("Cannot write data in the dataset.")); +msgerr($+1) = gettext("HDF5 description") + ": " + "src and dest data spaces have different sizes."; +assert_checkerror("h5write(a.root.mnt.Group_2, ""Dataset_2"", uint32([10 11;12 13]))",msgerr,999); +h5write(a.root.mnt.Group_2, "Dataset_2", uint32([10 11 2;12 13 9])); +h5umount(a, "/mnt"); +assert_checkequal(a.root.mnt.Groups,"Group_1"); +assert_checkequal(c.root.Group_2.Dataset_2.data,uint32([10 11 2;12 13 9])); +h5rm(a, "/mnt") +assert_checkequal(c.root.Group_2.Dataset_2.data,uint32([10 11 2;12 13 9])); +h5close(a, b, c) +assert_checkequal(h5read(TMPDIR+"/test2.h5","/Group_2/Dataset_2"),uint32([10 11 2;12 13 9])); diff --git a/modules/hdf5/tests/unit_tests/h5mount.tst b/modules/hdf5/tests/unit_tests/h5mount.tst new file mode 100755 index 000000000..86d0b11f9 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5mount.tst @@ -0,0 +1,53 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5mount", 3); +assert_checkerror("h5mount()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5mount", 3); +assert_checkerror("h5mount(42)",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A H5Object expected.\n"), "h5mount", 1); +assert_checkerror("h5mount(42,42,42)",msgerr,999); + +a = h5open(TMPDIR + "/test.h5", "w"); + +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A H5Object expected.\n"), "h5mount", 3); +assert_checkerror("h5mount(a,""42"",42)",msgerr,999); + + +h5group(a, "/mnt"); +b = h5open(TMPDIR + "/test1.h5", "w"); +h5group(b, "Group_1"); +h5write(b, "Group_1/Dataset_1", uint32([1 2;3 4])); +c = h5open(TMPDIR + "/test2.h5", "w"); +h5group(c, "Group_2"); +h5write(c, "Group_2/Dataset_2", uint32([14 15 16;17 18 19])); + +h5mount(a, "/mnt", b); +assert_checkequal(a.root.mnt.Groups,"Group_1"); +msgerr = msprintf(gettext("%s: %s\n"), "h5mount", msprintf(gettext("Cannot mount the file: %s"), TMPDIR + filesep() + "test1.h5")); +msgerr($+1) = gettext("HDF5 description") + ": " + "file is already mounted."; +assert_checkerror("h5mount(a, ""/mnt"", b)",msgerr,999); +h5mount(a, "/mnt", c); +assert_checkequal(a.root.mnt.Groups,"Group_2"); +msgerr = msprintf(gettext("%s: %s\n"), "h5mount", msprintf(gettext("Invalid location: %s"),"/test")); +assert_checkerror("h5mount(a,""/test"",c)",msgerr,999); +msgerr = msprintf(gettext("%s: Error in retrieving field content:\n%s\n"), "%H5Object_e", msprintf(gettext("Invalid field: %s"), "Group_1")); +assert_checkerror("h5write(a.root.mnt.Group_1, ""Dataset_1"", uint32([10 11;12 13]))",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5write", gettext("Cannot write data in the dataset.")); +msgerr($+1) = gettext("HDF5 description") + ": " + "src and dest data spaces have different sizes."; +assert_checkerror("h5write(a.root.mnt.Group_2, ""Dataset_2"", uint32([10 11;12 13]))",msgerr,999); +h5write(a.root.mnt.Group_2, "Dataset_2", uint32([10 11 2;12 13 9])); +h5umount(a, "/mnt"); +assert_checkequal(a.root.mnt.Groups,"Group_1"); +assert_checkequal(c.root.Group_2.Dataset_2.data,uint32([10 11 2;12 13 9])); +h5rm(a, "/mnt") +assert_checkequal(c.root.Group_2.Dataset_2.data,uint32([10 11 2;12 13 9])); +h5close(a, b, c) +assert_checkequal(h5read(TMPDIR+"/test2.h5","/Group_2/Dataset_2"),uint32([10 11 2;12 13 9])); + diff --git a/modules/hdf5/tests/unit_tests/h5mv.dia.ref b/modules/hdf5/tests/unit_tests/h5mv.dia.ref new file mode 100755 index 000000000..2d9aea6b2 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5mv.dia.ref @@ -0,0 +1,65 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5mv", 2, 4); +assert_checkerror("h5mv()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5mv", 1); +assert_checkerror("h5mv(42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Invalid number of arguments: more than %d expected.\n"), "h5mv", 2); +assert_checkerror("h5mv(""42"",42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5mv", 2); +assert_checkerror("h5mv(""42"",42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5mv", 3); +assert_checkerror("h5mv(""42"",""42"",42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5mv", msprintf(gettext("Invalid hdf5 file: %s."),"42")); +assert_checkerror("h5mv(""42"",""42"",""42"")",msgerr,999); +a = h5open(TMPDIR + "/test.h5"); +msgerr = msprintf(gettext("%s: %s\n"), "h5mv", msprintf(gettext("Invalid hdf5 file: %s."),"42")); +assert_checkerror("h5mv(a,""42"",""42"")",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5mv", gettext("Cannot copy object.")); +msgerr($+1) = gettext("HDF5 description") + ": " + "object ''42'' doesn''t exist."; +assert_checkerror("h5mv(a,""42"",a)",msgerr,999); +b = h5open(TMPDIR + "/test1.h5"); +c = h5open(TMPDIR + "/test2.h5"); +h5group(a, "Grp_1"); +h5write(a.root.Grp_1, "Dset_1", [1 2 ; 3 4]); +h5flush(a); +h5group(b, "BGrp"); +h5write(b("/BGrp"), "BDset", 11:18); +h5close(b) +h5group(c,"CGrp"); +h5write(c("/CGrp"),"CDset",(8:12)') +h5close(c); +msgerr = msprintf(gettext("%s: %s\n"), "h5mv", msprintf(gettext("Invalid hdf5 file: %s."), TMPDIR+"/test12.h5")); +assert_checkerror("h5mv(a.root.Grp_1,TMPDIR+""/test12.h5"",""/mnt"")",msgerr,999); +h5mv(a.root.Grp_1, "Dset_1", a, "Dset_2") +assert_checkequal(a.root.Datasets,"Dset_2"); +assert_checkequal(a.root.Dset_2.data,[1 2;3 4]); +msgerr = msprintf(gettext("%s: %s\n"), "h5mv", gettext("Cannot copy object.")); +msgerr($+1) = gettext("HDF5 description") + ": " + "no destination name specified."; +assert_checkerror("h5mv(a,a)",msgerr,999); +msgerr = msprintf(gettext("%s: Invalid number of arguments: more than %d expected.\n"), "h5mv", 2); +assert_checkerror("h5mv(a,12.0)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5mv", 1); +assert_checkerror("h5mv(12.0,a)",msgerr,999); +msgerr = msprintf(gettext("Undefined variable: %s\n"), "d"); +assert_checkerror("h5mv(a,d)",msgerr,4); +msgerr = msprintf(gettext("%s: Invalid H5Object.\n"), "h5mv"); +assert_checkerror("h5mv(a,c)",msgerr,999); +msgerr = msprintf(gettext("%s: Invalid number of arguments: more than %d expected.\n"), "h5mv", 2); +assert_checkerror("h5mv(a,""d"")",msgerr,999); +h5mv(TMPDIR +"/test1.h5", "/BGrp/BDset", a.root.Grp_1) +assert_checkequal(a.root.Grp_1.BDset.data,(11:18)); +assert_checkequal(a.root.Datasets,"Dset_2"); +h5close(a); +h5mv(TMPDIR+"/test.h5","/Grp_1",TMPDIR+"/test1.h5","/grp2"); +assert_checkequal(h5ls(TMPDIR+"/test1.h5"),["BGrp" "group";"grp2" "group"]); +a=h5open(TMPDIR+"/test.h5","a"); +msgerr = msprintf(gettext("%s: Error in retrieving field content:\n%s\n"), "%H5Object_e", msprintf(gettext("Invalid field: %s"), "Group_1")); +assert_checkerror("h5ls(a.root.Group_1)",msgerr,999); +assert_checkequal(h5ls(TMPDIR+"/test1.h5"),["BGrp" "group" ; "grp2" "group"]); diff --git a/modules/hdf5/tests/unit_tests/h5mv.tst b/modules/hdf5/tests/unit_tests/h5mv.tst new file mode 100755 index 000000000..8d1b0196d --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5mv.tst @@ -0,0 +1,80 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5mv", 2, 4); +assert_checkerror("h5mv()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5mv", 1); +assert_checkerror("h5mv(42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Invalid number of arguments: more than %d expected.\n"), "h5mv", 2); +assert_checkerror("h5mv(""42"",42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5mv", 2); +assert_checkerror("h5mv(""42"",42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5mv", 3); +assert_checkerror("h5mv(""42"",""42"",42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5mv", msprintf(gettext("Invalid hdf5 file: %s."),"42")); +assert_checkerror("h5mv(""42"",""42"",""42"")",msgerr,999); + +a = h5open(TMPDIR + "/test.h5"); + +msgerr = msprintf(gettext("%s: %s\n"), "h5mv", msprintf(gettext("Invalid hdf5 file: %s."),"42")); +assert_checkerror("h5mv(a,""42"",""42"")",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5mv", gettext("Cannot copy object.")); +msgerr($+1) = gettext("HDF5 description") + ": " + "object ''42'' doesn''t exist."; +assert_checkerror("h5mv(a,""42"",a)",msgerr,999); + +b = h5open(TMPDIR + "/test1.h5"); +c = h5open(TMPDIR + "/test2.h5"); +h5group(a, "Grp_1"); +h5write(a.root.Grp_1, "Dset_1", [1 2 ; 3 4]); +h5flush(a); +h5group(b, "BGrp"); +h5write(b("/BGrp"), "BDset", 11:18); +h5close(b) +h5group(c,"CGrp"); +h5write(c("/CGrp"),"CDset",(8:12)') +h5close(c); + +msgerr = msprintf(gettext("%s: %s\n"), "h5mv", msprintf(gettext("Invalid hdf5 file: %s."), TMPDIR+"/test12.h5")); +assert_checkerror("h5mv(a.root.Grp_1,TMPDIR+""/test12.h5"",""/mnt"")",msgerr,999); + +h5mv(a.root.Grp_1, "Dset_1", a, "Dset_2") +assert_checkequal(a.root.Datasets,"Dset_2"); +assert_checkequal(a.root.Dset_2.data,[1 2;3 4]); + +msgerr = msprintf(gettext("%s: %s\n"), "h5mv", gettext("Cannot copy object.")); +msgerr($+1) = gettext("HDF5 description") + ": " + "no destination name specified."; +assert_checkerror("h5mv(a,a)",msgerr,999); + +msgerr = msprintf(gettext("%s: Invalid number of arguments: more than %d expected.\n"), "h5mv", 2); +assert_checkerror("h5mv(a,12.0)",msgerr,999); + +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5mv", 1); +assert_checkerror("h5mv(12.0,a)",msgerr,999); + +msgerr = msprintf(gettext("Undefined variable: %s\n"), "d"); +assert_checkerror("h5mv(a,d)",msgerr,4); + +msgerr = msprintf(gettext("%s: Invalid H5Object.\n"), "h5mv"); +assert_checkerror("h5mv(a,c)",msgerr,999); + +msgerr = msprintf(gettext("%s: Invalid number of arguments: more than %d expected.\n"), "h5mv", 2); +assert_checkerror("h5mv(a,""d"")",msgerr,999); +h5mv(TMPDIR +"/test1.h5", "/BGrp/BDset", a.root.Grp_1) +assert_checkequal(a.root.Grp_1.BDset.data,(11:18)); +assert_checkequal(a.root.Datasets,"Dset_2"); +h5close(a); + +h5mv(TMPDIR+"/test.h5","/Grp_1",TMPDIR+"/test1.h5","/grp2"); +assert_checkequal(h5ls(TMPDIR+"/test1.h5"),["BGrp" "group";"grp2" "group"]); +a=h5open(TMPDIR+"/test.h5","a"); +msgerr = msprintf(gettext("%s: Error in retrieving field content:\n%s\n"), "%H5Object_e", msprintf(gettext("Invalid field: %s"), "Group_1")); +assert_checkerror("h5ls(a.root.Group_1)",msgerr,999); +assert_checkequal(h5ls(TMPDIR+"/test1.h5"),["BGrp" "group" ; "grp2" "group"]); + + diff --git a/modules/hdf5/tests/unit_tests/h5open.dia.ref b/modules/hdf5/tests/unit_tests/h5open.dia.ref new file mode 100755 index 000000000..bbe32ecaf --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5open.dia.ref @@ -0,0 +1,34 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5open", 1, 5); +assert_checkerror("h5open()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5open", 1); +assert_checkerror("h5open(42)",msgerr,999); +a = h5open(TMPDIR + "/x.sod"); +assert_checkequal(a.root.Name,'/') + ans = + + T +h5close(a); +x = 1:10; +save(TMPDIR + "/x.sod", "x"); +b = h5open(TMPDIR + "/x.sod"); +assert_checkequal(b.root.Datasets,'x'); +h5close(b); +a = h5open(TMPDIR + "/y.tst"); +assert_checkequal(a.root.Name,'/'); +h5write(a,"Dset_1",[1 2;3 4]); +h5close(a); +msgerr = msprintf(gettext("%s: %s\n"), "h5open", msprintf(gettext("Cannot append the file (not HDF5): %s."), pathconvert(SCI, %f) + filesep() + "COPYING-FR")); +msgerr($+1) = gettext("HDF5 description") + ": " + "unable to find a valid file signature."; +assert_checkerror("h5open(SCI + ""/COPYING-FR"")",msgerr,999); +copyfile(SCI+"/COPYING-FR",TMPDIR+"/z.h5"); +msgerr = msprintf(gettext("%s: %s\n"), "h5open", msprintf(gettext("Cannot append the file (not HDF5): %s."), TMPDIR + filesep() + "z.h5")); +msgerr($+1) = gettext("HDF5 description") + ": " + "unable to find a valid file signature."; +assert_checkerror("h5open(TMPDIR + ""/z.h5"")",msgerr,999); diff --git a/modules/hdf5/tests/unit_tests/h5open.tst b/modules/hdf5/tests/unit_tests/h5open.tst new file mode 100755 index 000000000..cb12af9d3 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5open.tst @@ -0,0 +1,35 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5open", 1, 5); +assert_checkerror("h5open()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5open", 1); +assert_checkerror("h5open(42)",msgerr,999); + +a = h5open(TMPDIR + "/x.sod"); +assert_checkequal(a.root.Name,'/') +h5close(a); +x = 1:10; +save(TMPDIR + "/x.sod", "x"); +b = h5open(TMPDIR + "/x.sod"); +assert_checkequal(b.root.Datasets,'x'); +h5close(b); +a = h5open(TMPDIR + "/y.tst"); +assert_checkequal(a.root.Name,'/'); +h5write(a,"Dset_1",[1 2;3 4]); +h5close(a); + +msgerr = msprintf(gettext("%s: %s\n"), "h5open", msprintf(gettext("Cannot append the file (not HDF5): %s."), pathconvert(SCI, %f) + filesep() + "COPYING-FR")); +msgerr($+1) = gettext("HDF5 description") + ": " + "unable to find a valid file signature."; +assert_checkerror("h5open(SCI + ""/COPYING-FR"")",msgerr,999); + +copyfile(SCI+"/COPYING-FR",TMPDIR+"/z.h5"); +msgerr = msprintf(gettext("%s: %s\n"), "h5open", msprintf(gettext("Cannot append the file (not HDF5): %s."), TMPDIR + filesep() + "z.h5")); +msgerr($+1) = gettext("HDF5 description") + ": " + "unable to find a valid file signature."; +assert_checkerror("h5open(TMPDIR + ""/z.h5"")",msgerr,999); diff --git a/modules/hdf5/tests/unit_tests/h5read.dia.ref b/modules/hdf5/tests/unit_tests/h5read.dia.ref new file mode 100755 index 000000000..92ceffd25 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5read.dia.ref @@ -0,0 +1,37 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5read", 1, 6); +assert_checkerror("h5read()",msgerr,77); +msgerr = msprintf(gettext("%s: Invalid number of input argument.\n"), "h5read"); +assert_checkerror("h5read(42)",msgerr,999); +assert_checkerror("h5read(""42"")",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5read", 1); +assert_checkerror("h5read(42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Second argument must be a dataset name.\n"), "h5read"); +assert_checkerror("h5read(""42"",42)",msgerr,999); +x = int8(matrix(1:80, 10, 8)); +save(TMPDIR + "/x.sod", "x"); // SOD files are HDF5 ones +y = [1 2;3 4]; +save(TMPDIR + "/y.sod", "y"); +a = h5open(TMPDIR + "/x.sod"); +msgerr = msprintf(gettext("%s: %s\n"), "h5read", gettext("Invalid object: not a dataset.")); +assert_checkerror("h5read(a)",msgerr,999); +assert_checkequal(h5read(a, "/x"),x); +assert_checkequal(h5read(a, "/x", [3 4], [5 3]),x(4:6,3:7)); +msgerr = msprintf(gettext("%s: %s\n"), "h5read", gettext("Invalid selection.")); +assert_checkerror("h5read(a,""/x"", [7 9], [10 12])",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5read", msprintf(gettext("Invalid name: %s."), "/y")); +assert_checkerror("h5read(a,""/y"")",msgerr,999); +assert_checkequal(h5read(a, "/x",[2 3],[3 3],[3 2]),int8([13 43 73;15 45 75;17 47 77])); +msgerr = msprintf(gettext("%s: %s\n"), "h5read", gettext("Invalid selection.")); +assert_checkerror("h5read(a,""/x"",[2 3],[3 3],[3 5])",msgerr,999); +h5close(a); +msgerr = msprintf(gettext("%s: Can not print H5Object: invalid object.\n"), "h5read"); +assert_checkerror("h5read(a)",msgerr,999); +assert_checkequal(h5read(TMPDIR+"/y.sod","/y"),[1,2;3,4]); diff --git a/modules/hdf5/tests/unit_tests/h5read.tst b/modules/hdf5/tests/unit_tests/h5read.tst new file mode 100755 index 000000000..dd79f6586 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5read.tst @@ -0,0 +1,41 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5read", 1, 6); +assert_checkerror("h5read()",msgerr,77); +msgerr = msprintf(gettext("%s: Invalid number of input argument.\n"), "h5read"); +assert_checkerror("h5read(42)",msgerr,999); +assert_checkerror("h5read(""42"")",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5read", 1); +assert_checkerror("h5read(42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Second argument must be a dataset name.\n"), "h5read"); +assert_checkerror("h5read(""42"",42)",msgerr,999); + +x = int8(matrix(1:80, 10, 8)); +save(TMPDIR + "/x.sod", "x"); // SOD files are HDF5 ones +y = [1 2;3 4]; +save(TMPDIR + "/y.sod", "y"); + +a = h5open(TMPDIR + "/x.sod"); +msgerr = msprintf(gettext("%s: %s\n"), "h5read", gettext("Invalid object: not a dataset.")); +assert_checkerror("h5read(a)",msgerr,999); +assert_checkequal(h5read(a, "/x"),x); +assert_checkequal(h5read(a, "/x", [3 4], [5 3]),x(4:6,3:7)); +msgerr = msprintf(gettext("%s: %s\n"), "h5read", gettext("Invalid selection.")); +assert_checkerror("h5read(a,""/x"", [7 9], [10 12])",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5read", msprintf(gettext("Invalid name: %s."), "/y")); +assert_checkerror("h5read(a,""/y"")",msgerr,999); +assert_checkequal(h5read(a, "/x",[2 3],[3 3],[3 2]),int8([13 43 73;15 45 75;17 47 77])); +msgerr = msprintf(gettext("%s: %s\n"), "h5read", gettext("Invalid selection.")); +assert_checkerror("h5read(a,""/x"",[2 3],[3 3],[3 5])",msgerr,999); +h5close(a); + +msgerr = msprintf(gettext("%s: Can not print H5Object: invalid object.\n"), "h5read"); +assert_checkerror("h5read(a)",msgerr,999); +assert_checkequal(h5read(TMPDIR+"/y.sod","/y"),[1,2;3,4]); diff --git a/modules/hdf5/tests/unit_tests/h5readattr.dia.ref b/modules/hdf5/tests/unit_tests/h5readattr.dia.ref new file mode 100755 index 000000000..cd7b14bb8 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5readattr.dia.ref @@ -0,0 +1,60 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5readattr", 1, 3); +assert_checkerror("h5readattr()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5readattr", 1); +assert_checkerror("h5readattr(42)",msgerr,999); +msgerr = msprintf(gettext("%s: Invalid number of argument(s): %d expected.\n"), "h5readattr", 3); +assert_checkerror("h5readattr(""42"")",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5readattr", 2); +assert_checkerror("h5readattr(""42"",42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5readattr", 3); +assert_checkerror("h5readattr(""42"",""42"",42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5readattr", msprintf(gettext("Invalid hdf5 file: %s."), "42")); +assert_checkerror("h5readattr(""42"",""42"",""42"")",msgerr,999); +x = int8(matrix(1:80, 10, 8)); +save(TMPDIR + "/x.sod", "x"); +a = h5open(TMPDIR + "/x.sod"); +scilab_version = h5readattr(a, "/", "SCILAB_scilab_version"); +version = getversion(); +if ~isempty(strindex(version, "branch")) then // compiled by user + version = string(getversion("scilab")); + version = getversion()+" "+strcat([version(1),version(2),version(3)],"."); +else // compiled by compilation chain + version = getversion(); +end +assert_checkequal(scilab_version,version); +scilab_class = h5readattr(a.root.x, "SCILAB_Class"); +assert_checkequal(scilab_class,"integer"); +msgerr = msprintf(gettext("%s: %s\n"), "h5readattr", msprintf(gettext("Cannot open attribute: %s"), "test")); +assert_checkerror("h5readattr(a.root.x, ""test"")",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5readattr", msprintf(gettext("Invalid name: %s."), "")); +msgerr($+1) = gettext("HDF5 description") + ": " + "no attribute name."; +assert_checkerror("h5readattr(a.root.x)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5readattr", msprintf(gettext("Cannot open attribute: %s"), "Attributes")); +assert_checkerror("h5readattr(a.root.x,""Attributes"")",msgerr,999); +//After closing, all h5readattr will fail +h5close(a); +msgerr = msprintf(gettext("%s: Invalid H5Object.\n"), "h5readattr"); +assert_checkerror("h5readattr(a, ""/"", ""SCILAB_scilab_version"")",msgerr,999); +msgerr = msprintf(gettext("%s: Invalid H5Object.\n"), "%H5Object_e"); +assert_checkerror("h5readattr(a.root.x, ""SCILAB_Class"")",msgerr,999); +assert_checkerror("h5readattr(a.root.x, ""test"")",msgerr,999); +assert_checkerror("h5readattr(a.root.x)",msgerr,999); +assert_checkerror("h5readattr(a.root.x,""Attributes"")",msgerr,999); +// non hdf5 variable +b=1; +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5readattr", 1); +assert_checkerror("h5readattr(b)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5readattr", 1); +assert_checkerror("h5readattr(b,""/"")",msgerr,999); +b="hello"; +msgerr = msprintf(gettext("%s: %s\n"), "h5readattr", msprintf(gettext("Invalid hdf5 file: %s."), b)); +assert_checkerror("h5readattr(b,""/"")",msgerr,999); +assert_checkequal(deletefile(TMPDIR+"/x.sod"),%T); diff --git a/modules/hdf5/tests/unit_tests/h5readattr.tst b/modules/hdf5/tests/unit_tests/h5readattr.tst new file mode 100755 index 000000000..ee6f28cf3 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5readattr.tst @@ -0,0 +1,72 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5readattr", 1, 3); +assert_checkerror("h5readattr()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5readattr", 1); +assert_checkerror("h5readattr(42)",msgerr,999); +msgerr = msprintf(gettext("%s: Invalid number of argument(s): %d expected.\n"), "h5readattr", 3); +assert_checkerror("h5readattr(""42"")",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5readattr", 2); +assert_checkerror("h5readattr(""42"",42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5readattr", 3); +assert_checkerror("h5readattr(""42"",""42"",42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5readattr", msprintf(gettext("Invalid hdf5 file: %s."), "42")); +assert_checkerror("h5readattr(""42"",""42"",""42"")",msgerr,999); + +x = int8(matrix(1:80, 10, 8)); +save(TMPDIR + "/x.sod", "x"); + +a = h5open(TMPDIR + "/x.sod"); +scilab_version = h5readattr(a, "/", "SCILAB_scilab_version"); + +version = getversion(); +if ~isempty(strindex(version, "branch")) then // compiled by user + version = string(getversion("scilab")); + version = getversion()+" "+strcat([version(1),version(2),version(3)],"."); +else // compiled by compilation chain + version = getversion(); +end +assert_checkequal(scilab_version,version); + +scilab_class = h5readattr(a.root.x, "SCILAB_Class"); +assert_checkequal(scilab_class,"integer"); + +msgerr = msprintf(gettext("%s: %s\n"), "h5readattr", msprintf(gettext("Cannot open attribute: %s"), "test")); +assert_checkerror("h5readattr(a.root.x, ""test"")",msgerr,999); + +msgerr = msprintf(gettext("%s: %s\n"), "h5readattr", msprintf(gettext("Invalid name: %s."), "")); +msgerr($+1) = gettext("HDF5 description") + ": " + "no attribute name."; +assert_checkerror("h5readattr(a.root.x)",msgerr,999); + +msgerr = msprintf(gettext("%s: %s\n"), "h5readattr", msprintf(gettext("Cannot open attribute: %s"), "Attributes")); +assert_checkerror("h5readattr(a.root.x,""Attributes"")",msgerr,999); +//After closing, all h5readattr will fail +h5close(a); + +msgerr = msprintf(gettext("%s: Invalid H5Object.\n"), "h5readattr"); +assert_checkerror("h5readattr(a, ""/"", ""SCILAB_scilab_version"")",msgerr,999); +msgerr = msprintf(gettext("%s: Invalid H5Object.\n"), "%H5Object_e"); +assert_checkerror("h5readattr(a.root.x, ""SCILAB_Class"")",msgerr,999); +assert_checkerror("h5readattr(a.root.x, ""test"")",msgerr,999); +assert_checkerror("h5readattr(a.root.x)",msgerr,999); +assert_checkerror("h5readattr(a.root.x,""Attributes"")",msgerr,999); + +// non hdf5 variable +b=1; +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5readattr", 1); +assert_checkerror("h5readattr(b)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5readattr", 1); +assert_checkerror("h5readattr(b,""/"")",msgerr,999); +b="hello"; +msgerr = msprintf(gettext("%s: %s\n"), "h5readattr", msprintf(gettext("Invalid hdf5 file: %s."), b)); +assert_checkerror("h5readattr(b,""/"")",msgerr,999); + + +assert_checkequal(deletefile(TMPDIR+"/x.sod"),%T); diff --git a/modules/hdf5/tests/unit_tests/h5rm.dia.ref b/modules/hdf5/tests/unit_tests/h5rm.dia.ref new file mode 100755 index 000000000..4ac6de28e --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5rm.dia.ref @@ -0,0 +1,50 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"),"h5rm", 1, 2); +assert_checkerror("h5rm()", msgerr, 77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string or a H5Object expected.\n"), "h5rm", 1); +assert_checkerror("h5rm(42)", msgerr, 999); +msgerr = msprintf(gettext("%s: Wrong number of input arguments: %d expected.\n"),"h5rm", 2); +assert_checkerror("h5rm(""42"")", msgerr, 999); +msgerr = msprintf(gettext("%s: %s\n"), "h5rm", msprintf(gettext("Invalid hdf5 file: %s."), "42")); +assert_checkerror("h5rm(""42"",""42"")", msgerr, 999); +a = h5open(TMPDIR + "/test.h5", "a"); +names = "Group_" + string(1:10); +h5group(a, names) +names = "Group_" + string(2:10); +h5rm(a,"Group_1"); +assert_checkequal(a.root.Groups,gsort(names',"g",'i')); +halfnames = "Group_" + string(2:2:10); +oppositehalfnames = "Group_" + string(3:2:10); +h5rm(a,halfnames); +assert_checkequal(a.root.Groups,gsort(oppositehalfnames',"g",'i')); +msgerr = msprintf(gettext("%s: %s\n"), "h5rm", msprintf(gettext("The name doesn''t exist: %s."), "failingtest")); +assert_checkerror('h5rm(a,""failingtest"")', msgerr, 999); +msgerr = msprintf(gettext("%s: %s\n"), "h5rm", gettext("Cannot remove a file.")); +assert_checkerror('h5rm(a)', msgerr, 999); +msgerr = msprintf(gettext("%s: %s\n"), "h5rm", gettext("Cannot remove root element.")); +assert_checkerror('h5rm(a.root)', msgerr, 999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string or a H5Object expected.\n"), "h5rm", 1); +assert_checkerror('h5rm(a.root.Groups)', msgerr, 999); +h5write(a.root.Group_3, "Dset_1", [1 2 ; 3 4]); +h5ln(a, "Hard_Link", "/Group_3/Dset_1", %t); +h5rm(a,"Hard_Link"); +msgerr = msprintf(gettext("%s: Error in retrieving field content:\n%s\n"), "%H5Object_e", msprintf(gettext("Invalid field: %s"), "Hard_Link")); +assert_checkerror('a.root.Hard_Link', msgerr, 999); +h5rm(a,"/Group_3/Dset_1"); +msgerr = msprintf(gettext("%s: Error in retrieving field content:\n%s\n"), "%H5Object_e", msprintf(gettext("Invalid field: %s"), "Dset_1")); +assert_checkerror('a.root.Group_3.Dset_1', msgerr, 999); +h5ln(a,"Soft_Link",".Group_1/Dset_1"); +msgerr = msprintf(gettext("%s: Error in retrieving field content:\n%s\n"), "%H5Object_e", msprintf(gettext("Invalid field: %s"), "Soft_Link")); +assert_checkerror('h5rm(a,a.root.Soft_Link)', msgerr, 999); +h5rm(a,a.root.Softs); +assert_checkequal(a.root.Softs,[]); +h5write(a.root.Group_3, "Dset_1", [1 2 ; 3 4]); +h5ln(a,"Soft_Link",".Group_3/Dset_1"); +h5close(a); diff --git a/modules/hdf5/tests/unit_tests/h5rm.tst b/modules/hdf5/tests/unit_tests/h5rm.tst new file mode 100755 index 000000000..57acf2898 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5rm.tst @@ -0,0 +1,56 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"),"h5rm", 1, 2); +assert_checkerror("h5rm()", msgerr, 77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string or a H5Object expected.\n"), "h5rm", 1); +assert_checkerror("h5rm(42)", msgerr, 999); +msgerr = msprintf(gettext("%s: Wrong number of input arguments: %d expected.\n"),"h5rm", 2); +assert_checkerror("h5rm(""42"")", msgerr, 999); +msgerr = msprintf(gettext("%s: %s\n"), "h5rm", msprintf(gettext("Invalid hdf5 file: %s."), "42")); +assert_checkerror("h5rm(""42"",""42"")", msgerr, 999); + + +a = h5open(TMPDIR + "/test.h5", "a"); +names = "Group_" + string(1:10); +h5group(a, names) +names = "Group_" + string(2:10); +h5rm(a,"Group_1"); +assert_checkequal(a.root.Groups,gsort(names',"g",'i')); +halfnames = "Group_" + string(2:2:10); +oppositehalfnames = "Group_" + string(3:2:10); +h5rm(a,halfnames); +assert_checkequal(a.root.Groups,gsort(oppositehalfnames',"g",'i')); +msgerr = msprintf(gettext("%s: %s\n"), "h5rm", msprintf(gettext("The name doesn''t exist: %s."), "failingtest")); +assert_checkerror('h5rm(a,""failingtest"")', msgerr, 999); +msgerr = msprintf(gettext("%s: %s\n"), "h5rm", gettext("Cannot remove a file.")); +assert_checkerror('h5rm(a)', msgerr, 999); +msgerr = msprintf(gettext("%s: %s\n"), "h5rm", gettext("Cannot remove root element.")); +assert_checkerror('h5rm(a.root)', msgerr, 999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string or a H5Object expected.\n"), "h5rm", 1); +assert_checkerror('h5rm(a.root.Groups)', msgerr, 999); + +h5write(a.root.Group_3, "Dset_1", [1 2 ; 3 4]); +h5ln(a, "Hard_Link", "/Group_3/Dset_1", %t); +h5rm(a,"Hard_Link"); +msgerr = msprintf(gettext("%s: Error in retrieving field content:\n%s\n"), "%H5Object_e", msprintf(gettext("Invalid field: %s"), "Hard_Link")); +assert_checkerror('a.root.Hard_Link', msgerr, 999); +h5rm(a,"/Group_3/Dset_1"); +msgerr = msprintf(gettext("%s: Error in retrieving field content:\n%s\n"), "%H5Object_e", msprintf(gettext("Invalid field: %s"), "Dset_1")); +assert_checkerror('a.root.Group_3.Dset_1', msgerr, 999); + +h5ln(a,"Soft_Link",".Group_1/Dset_1"); +msgerr = msprintf(gettext("%s: Error in retrieving field content:\n%s\n"), "%H5Object_e", msprintf(gettext("Invalid field: %s"), "Soft_Link")); +assert_checkerror('h5rm(a,a.root.Soft_Link)', msgerr, 999); +h5rm(a,a.root.Softs); +assert_checkequal(a.root.Softs,[]); +h5write(a.root.Group_3, "Dset_1", [1 2 ; 3 4]); +h5ln(a,"Soft_Link",".Group_3/Dset_1"); + +h5close(a); diff --git a/modules/hdf5/tests/unit_tests/h5umount.dia.ref b/modules/hdf5/tests/unit_tests/h5umount.dia.ref new file mode 100755 index 000000000..6ede0817c --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5umount.dia.ref @@ -0,0 +1,58 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5umount", 2); +assert_checkerror("h5umount()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5umount", 2); +assert_checkerror("h5umount(42)",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A H5Object expected.\n"), "h5umount", 1); +assert_checkerror("h5umount(42,42)",msgerr,999); +a = h5open(TMPDIR + "/test.h5", "w"); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5umount", 2); +assert_checkerror("h5umount(a,42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5umount", msprintf(gettext("Cannot unmount the file at location: %s"), "42")); +msgerr($+1) = gettext("HDF5 description") + ": " + "object ''42'' doesn''t exist."; +assert_checkerror("h5umount(a,""42"")",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A H5Object expected.\n"), "h5umount", 1); +assert_checkerror("h5umount(""42"",""42"")",msgerr,999); +h5group(a, "/mnt"); +b = h5open(TMPDIR + "/test1.h5", "w"); +h5group(b, "Group_1"); +h5write(b, "Group_1/Dataset_1", [1 2;3 4]); +h5mount(a, "/mnt", b); +assert_checkequal(a.root.mnt.Group_1.Dataset_1.data,[1 2;3 4]); +h5write(a.root.mnt.Group_1, "Dataset_1", [10 11;12 13]); +assert_checkequal(a.root.mnt.Group_1.Dataset_1.data,[10 11;12 13]); +assert_checkequal(b.root.mnt.Group_1.Dataset_1.data,[10 11;12 13]); +h5umount(a, "/mnt"); +assert_checkequal(a.root.mnt.Groups,[]); +assert_checkequal(b.root.Group_1.Dataset_1.data,[10 11;12 13]); +h5rm(a, "/mnt"); +msgerr = msprintf(gettext("%s: Error in retrieving field content:\n%s\n"), "%H5Object_e", msprintf(gettext("Invalid field: %s"), "mnt")); +assert_checkerror("a.root.mnt",msgerr,999); +assert_checkequal(b.root.Group_1.Dataset_1.data,[10 11;12 13]); +h5group(a,"/mnt"); +h5mount(a,"/mnt",b); +h5close(a, b); +assert_checkequal(h5ls(TMPDIR+"/test.h5","/"),["mnt" "group"]); +assert_checkequal(h5ls(TMPDIR+"/test.h5","/mnt"),[]); +assert_checkequal(h5ls(TMPDIR+"/test1.h5","/"),["Group_1" "group"]); +a = h5open(TMPDIR+"/test.h5","a"); +for i=1:10 + execstr("ref_"+string(i)+"=h5open("""+TMPDIR+"/test_"+string(i)+".h5"",""w"")"); + execstr("h5group(ref_"+string(i)+",""/Group_"+string(i)+""")"); + execstr("h5mount(a,""/mnt"",ref_"+string(i)+")"); + assert_checkequal(a.root.mnt.Groups,"Group_"+string(i)); +end +for i=10:-1:1 + execstr("h5umount(a,""/mnt"")"); + if i ~= 1 then + assert_checkequal(a.root.mnt.Groups,"Group_"+string(i-1)); + end + execstr("h5close(ref_"+string(i)+")"); +end diff --git a/modules/hdf5/tests/unit_tests/h5umount.tst b/modules/hdf5/tests/unit_tests/h5umount.tst new file mode 100755 index 000000000..c5615b27c --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5umount.tst @@ -0,0 +1,66 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5umount", 2); +assert_checkerror("h5umount()",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "h5umount", 2); +assert_checkerror("h5umount(42)",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A H5Object expected.\n"), "h5umount", 1); +assert_checkerror("h5umount(42,42)",msgerr,999); +a = h5open(TMPDIR + "/test.h5", "w"); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5umount", 2); +assert_checkerror("h5umount(a,42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5umount", msprintf(gettext("Cannot unmount the file at location: %s"), "42")); +msgerr($+1) = gettext("HDF5 description") + ": " + "object ''42'' doesn''t exist."; +assert_checkerror("h5umount(a,""42"")",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A H5Object expected.\n"), "h5umount", 1); +assert_checkerror("h5umount(""42"",""42"")",msgerr,999); + + +h5group(a, "/mnt"); +b = h5open(TMPDIR + "/test1.h5", "w"); +h5group(b, "Group_1"); +h5write(b, "Group_1/Dataset_1", [1 2;3 4]); + +h5mount(a, "/mnt", b); +assert_checkequal(a.root.mnt.Group_1.Dataset_1.data,[1 2;3 4]); +h5write(a.root.mnt.Group_1, "Dataset_1", [10 11;12 13]); +assert_checkequal(a.root.mnt.Group_1.Dataset_1.data,[10 11;12 13]); +assert_checkequal(b.root.mnt.Group_1.Dataset_1.data,[10 11;12 13]); +h5umount(a, "/mnt"); +assert_checkequal(a.root.mnt.Groups,[]); +assert_checkequal(b.root.Group_1.Dataset_1.data,[10 11;12 13]); +h5rm(a, "/mnt"); +msgerr = msprintf(gettext("%s: Error in retrieving field content:\n%s\n"), "%H5Object_e", msprintf(gettext("Invalid field: %s"), "mnt")); +assert_checkerror("a.root.mnt",msgerr,999); +assert_checkequal(b.root.Group_1.Dataset_1.data,[10 11;12 13]); + +h5group(a,"/mnt"); +h5mount(a,"/mnt",b); + + +h5close(a, b); +assert_checkequal(h5ls(TMPDIR+"/test.h5","/"),["mnt" "group"]); +assert_checkequal(h5ls(TMPDIR+"/test.h5","/mnt"),[]); +assert_checkequal(h5ls(TMPDIR+"/test1.h5","/"),["Group_1" "group"]); + +a = h5open(TMPDIR+"/test.h5","a"); +for i=1:10 + execstr("ref_"+string(i)+"=h5open("""+TMPDIR+"/test_"+string(i)+".h5"",""w"")"); + execstr("h5group(ref_"+string(i)+",""/Group_"+string(i)+""")"); + execstr("h5mount(a,""/mnt"",ref_"+string(i)+")"); + assert_checkequal(a.root.mnt.Groups,"Group_"+string(i)); +end +for i=10:-1:1 + execstr("h5umount(a,""/mnt"")"); + if i ~= 1 then + assert_checkequal(a.root.mnt.Groups,"Group_"+string(i-1)); + end + execstr("h5close(ref_"+string(i)+")"); +end diff --git a/modules/hdf5/tests/unit_tests/h5write.dia.ref b/modules/hdf5/tests/unit_tests/h5write.dia.ref new file mode 100755 index 000000000..8dd9bb26a --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5write.dia.ref @@ -0,0 +1,37 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5write", 3, 8); +assert_checkerror("h5write()",msgerr,77); +assert_checkerror("h5write(42)",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string or a H5Object expected.\n"), "h5write", 1); +assert_checkerror("h5write(42,42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5write", 2); +assert_checkerror("h5write(""42"",42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5write", msprintf(gettext("Invalid hdf5 file: %s."), "42")); +assert_checkerror("h5write(""42"",""42"",42)",msgerr,999); +x = matrix(1:20, 4, 5); +save(TMPDIR + "/x.sod", "x"); +a = h5open(TMPDIR + "/x.sod"); +y = uint32(matrix(10:30, 7, 3)); +h5write(a, "y", y); +assert_checkequal(a.root.y.Data,y); +h5write(a, "z", y, "H5T_MIPS_U32"); +assert_checkequal(a.root.z.Data,y); +x = uint32(matrix(1:(11*17), 11, 17)); +dx = 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)),.. + cat(1,x(1:3,8:9),x(6:8,8:9)),cat(1,x(1:3,11:12),x(6:8,11:12))); +h5write(a, "t", x, [1 2], [2 4], [5 3], [3 2]); +assert_checkequal(a.root.t.Data,dx); +dx = x(2:6,4:6); +h5write(a,"t2",x, [2 4],[5 3]); +assert_checkequal(a.root.t2.data,dx); +msgerr = msprintf(gettext("%s: %s\n"), "h5write", gettext("Invalid selection.")); +assert_checkerror("h5write(a,""t3"",x, [22 22],[2 4],[5 3],[3 2])",msgerr,999); +assert_checkerror("h5write(a,""t3"",x, [1 2],[12 44],[5 3],[3 2])",msgerr,999); +h5close(a); diff --git a/modules/hdf5/tests/unit_tests/h5write.tst b/modules/hdf5/tests/unit_tests/h5write.tst new file mode 100755 index 000000000..7f047df84 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/h5write.tst @@ -0,0 +1,42 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SCILAB ENTERPRISES - Simon GARESTE +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> + +msgerr = msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "h5write", 3, 8); +assert_checkerror("h5write()",msgerr,77); +assert_checkerror("h5write(42)",msgerr,77); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string or a H5Object expected.\n"), "h5write", 1); +assert_checkerror("h5write(42,42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5write", 2); +assert_checkerror("h5write(""42"",42,42)",msgerr,999); +msgerr = msprintf(gettext("%s: %s\n"), "h5write", msprintf(gettext("Invalid hdf5 file: %s."), "42")); +assert_checkerror("h5write(""42"",""42"",42)",msgerr,999); + +x = matrix(1:20, 4, 5); +save(TMPDIR + "/x.sod", "x"); +a = h5open(TMPDIR + "/x.sod"); +y = uint32(matrix(10:30, 7, 3)); +h5write(a, "y", y); +assert_checkequal(a.root.y.Data,y); +h5write(a, "z", y, "H5T_MIPS_U32"); +assert_checkequal(a.root.z.Data,y); + +x = uint32(matrix(1:(11*17), 11, 17)); +dx = 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)),.. + cat(1,x(1:3,8:9),x(6:8,8:9)),cat(1,x(1:3,11:12),x(6:8,11:12))); +h5write(a, "t", x, [1 2], [2 4], [5 3], [3 2]); +assert_checkequal(a.root.t.Data,dx); + +dx = x(2:6,4:6); +h5write(a,"t2",x, [2 4],[5 3]); +assert_checkequal(a.root.t2.data,dx); + +msgerr = msprintf(gettext("%s: %s\n"), "h5write", gettext("Invalid selection.")); +assert_checkerror("h5write(a,""t3"",x, [22 22],[2 4],[5 3],[3 2])",msgerr,999); +assert_checkerror("h5write(a,""t3"",x, [1 2],[12 44],[5 3],[3 2])",msgerr,999); +h5close(a); diff --git a/modules/hdf5/tests/unit_tests/loadhdf5data.dia.ref b/modules/hdf5/tests/unit_tests/loadhdf5data.dia.ref new file mode 100755 index 000000000..f65d864f2 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/loadhdf5data.dia.ref @@ -0,0 +1,149 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Sylvestre LEDRU +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +// Load previously saved data (check backward compatibility) +///// Empty matrix +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/emptymatrix.sod"); +assert_checkequal(emptymatrix, []); +///// Double +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricedoublescalar.sod"); +assert_checkequal(ascalar,42); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricedouble.sod"); +assert_checkequal(a,[2,3;4,5]); +///// Double complex +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricedoublecomplex.sod"); +assert_checkequal(b,[2+%i,3+%i*2;4+%i*%pi,5]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricedoublecomplexscalar.sod"); +assert_checkequal(bscalar,42+%i); +///// String +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricestring.sod"); +assert_checkequal(c,["my matrix","of strings";"is","saved in Scilab data format"]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricestringscalar.sod"); +assert_checkequal(cscalar,["my single string"]); +// Polynomials +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/polynomials.sod"); +p_reference=poly([1 2],'s') ; +assert_checkequal(p,p_reference); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/polynomialscoef.sod"); +q_reference=poly([1 42],'s','c'); +assert_checkequal(q,q_reference); +// Boolean matrices +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/booleanscalar.sod"); +assert_checkequal(bm,%t); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/booleanmatrix.sod"); +assert_checkequal(bmm,[%t,%f; %f, %t]); +// Sparse +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/sparsematrix.sod"); +assert_checkequal(sp,sparse([1,2;4,5;3,10],[1,2,3])); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/emptysparse.sod"); +assert_checkequal(emptysparse,sparse([])); +// boolean sparse +dense=[%F, %F, %T, %F, %F +%T, %F, %F, %F, %F +%F, %F, %F, %F, %F +%F, %F, %F, %F, %T]; +sp_reference=sparse(dense); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/booleansparse.sod"); +assert_checkequal(sp,sp_reference); +// List +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/list.sod"); +assert_checkequal(ls,list(2,%i,'f',ones(3,3))); +ls(2) = list( %t, [32,42]); // alter ls to add the list +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/listnested.sod"); +assert_checkequal(lsnested,ls); +// tlist +lst_reference = tlist(['random numbers';'Name';'Example'], 'Uniform',ones(1,2, 3)); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/tlist.sod"); +assert_checkequal(lst,lst_reference); +// mlist +M_ref=mlist(['V','name','value'],['a','b';'c' 'd'],[1 2; 3 4]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/mlist.sod"); +// Commented because of bug 9531 +//assert_checkequal(M_ref,M); +// hypermatrices +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/hypermatrix.sod"); +assert_checkequal(HM,hypermat([2 3 2 2],1:24)); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/hypermatrixcomplex.sod"); +HMC_reference(1,1,1,1:2)=[1+%i 2*2*%i]; +assert_checkequal(HMC,HMC_reference); +// int +emptyint8matrix_ref = int8([]); +int8scalar_ref = int8(1); +int8rowvector_ref = int8([1 -4 7]); +int8colvector_ref = int8([1;-4;7]); +int8matrix_ref = int8([1 -4 7;-9 6 -3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/int8.sod"); +assert_checkequal(emptyint8matrix, emptyint8matrix_ref); +assert_checkequal(int8scalar, int8scalar_ref); +assert_checkequal(int8rowvector, int8rowvector_ref); +assert_checkequal(int8colvector, int8colvector_ref); +assert_checkequal(int8matrix, int8matrix_ref); +emptyint16matrix_ref = int16([]); +int16scalar_ref = int16(1); +int16rowvector_ref = int16([1 -4 7]); +int16colvector_ref = int16([1;-4;7]); +int16matrix_ref = int16([1 -4 7;-9 6 -3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/int16.sod"); +assert_checkequal(emptyint16matrix, emptyint16matrix_ref); +assert_checkequal(int16scalar, int16scalar_ref); +assert_checkequal(int16rowvector, int16rowvector_ref); +assert_checkequal(int16colvector, int16colvector_ref); +assert_checkequal(int16matrix, int16matrix_ref); +emptyint32matrix_ref = int32([]); +int32scalar_ref = int32(1); +int32rowvector_ref = int32([1 -4 7]); +int32colvector_ref = int32([1;-4;7]); +int32matrix_ref = int32([1 -4 7;-9 6 -3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/int32.sod"); +assert_checkequal(emptyint32matrix, emptyint32matrix_ref); +assert_checkequal(int32scalar, int32scalar_ref); +assert_checkequal(int32rowvector, int32rowvector_ref); +assert_checkequal(int32colvector, int32colvector_ref); +assert_checkequal(int32matrix, int32matrix_ref); +emptyuint8matrix_ref = uint8([]); +uint8scalar_ref = uint8(1); +uint8rowvector_ref = uint8([1 4 7]); +uint8colvector_ref = uint8([1;4;7]); +uint8matrix_ref = uint8([1 4 7;9 6 3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/uint8.sod"); +assert_checkequal(emptyuint8matrix, emptyuint8matrix_ref); +assert_checkequal(uint8scalar, uint8scalar_ref); +assert_checkequal(uint8rowvector, uint8rowvector_ref); +assert_checkequal(uint8colvector, uint8colvector_ref); +assert_checkequal(uint8matrix, uint8matrix_ref); +emptyuint16matrix_ref = uint16([]); +uint16scalar_ref = uint16(1); +uint16rowvector_ref = uint16([1 4 7]); +uint16colvector_ref = uint16([1;4;7]); +uint16matrix_ref = uint16([1 4 7;9 6 3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/uint16.sod"); +assert_checkequal(emptyuint16matrix, emptyuint16matrix_ref); +assert_checkequal(uint16scalar, uint16scalar_ref); +assert_checkequal(uint16rowvector, uint16rowvector_ref); +assert_checkequal(uint16colvector, uint16colvector_ref); +assert_checkequal(uint16matrix, uint16matrix_ref); +emptyuint32matrix_ref = uint32([]); +uint32scalar_ref = uint32(1); +uint32rowvector_ref = uint32([1 4 7]); +uint32colvector_ref = uint32([1;4;7]); +uint32matrix_ref = uint32([1 4 7;9 6 3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/uint32.sod"); +assert_checkequal(emptyuint32matrix, emptyuint32matrix_ref); +assert_checkequal(uint32scalar, uint32scalar_ref); +assert_checkequal(uint32rowvector, uint32rowvector_ref); +assert_checkequal(uint32colvector, uint32colvector_ref); +assert_checkequal(uint32matrix, uint32matrix_ref); +// undefined +undefinedelement_ref=list(2,%i,'f',ones(3,3)); +undefinedelement_ref(6)="toto"; +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/undefinedelement.sod"); +assert_checkequal(undefinedelement, undefinedelement_ref); +// void +voidelement_ref=list(1,,3); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/voidelement.sod"); +// Commented because of bug 9529 +//assert_checkequal(voidelement, voidelement_ref); diff --git a/modules/hdf5/tests/unit_tests/loadhdf5data.tst b/modules/hdf5/tests/unit_tests/loadhdf5data.tst new file mode 100755 index 000000000..59ec2321d --- /dev/null +++ b/modules/hdf5/tests/unit_tests/loadhdf5data.tst @@ -0,0 +1,190 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Sylvestre LEDRU +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> + +// Load previously saved data (check backward compatibility) + + +///// Empty matrix +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/emptymatrix.sod"); +assert_checkequal(emptymatrix, []); + +///// Double +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricedoublescalar.sod"); +assert_checkequal(ascalar,42); + +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricedouble.sod"); +assert_checkequal(a,[2,3;4,5]); + + +///// Double complex +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricedoublecomplex.sod"); +assert_checkequal(b,[2+%i,3+%i*2;4+%i*%pi,5]); + +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricedoublecomplexscalar.sod"); +assert_checkequal(bscalar,42+%i); + + +///// String +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricestring.sod"); +assert_checkequal(c,["my matrix","of strings";"is","saved in Scilab data format"]); + +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricestringscalar.sod"); +assert_checkequal(cscalar,["my single string"]); + +// Polynomials +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/polynomials.sod"); +p_reference=poly([1 2],'s') ; +assert_checkequal(p,p_reference); + +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/polynomialscoef.sod"); +q_reference=poly([1 42],'s','c'); +assert_checkequal(q,q_reference); + + +// Boolean matrices +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/booleanscalar.sod"); +assert_checkequal(bm,%t); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/booleanmatrix.sod"); +assert_checkequal(bmm,[%t,%f; %f, %t]); + +// Sparse +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/sparsematrix.sod"); +assert_checkequal(sp,sparse([1,2;4,5;3,10],[1,2,3])); + +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/emptysparse.sod"); +assert_checkequal(emptysparse,sparse([])); + +// boolean sparse +dense=[%F, %F, %T, %F, %F +%T, %F, %F, %F, %F +%F, %F, %F, %F, %F +%F, %F, %F, %F, %T]; +sp_reference=sparse(dense); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/booleansparse.sod"); +assert_checkequal(sp,sp_reference); + +// List +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/list.sod"); +assert_checkequal(ls,list(2,%i,'f',ones(3,3))); +ls(2) = list( %t, [32,42]); // alter ls to add the list +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/listnested.sod"); +assert_checkequal(lsnested,ls); + +// tlist +lst_reference = tlist(['random numbers';'Name';'Example'], 'Uniform',ones(1,2, 3)); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/tlist.sod"); +assert_checkequal(lst,lst_reference); + +// mlist +M_ref=mlist(['V','name','value'],['a','b';'c' 'd'],[1 2; 3 4]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/mlist.sod"); +// Commented because of bug 9531 +//assert_checkequal(M_ref,M); + +// hypermatrices +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/hypermatrix.sod"); +assert_checkequal(HM,hypermat([2 3 2 2],1:24)); + +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/hypermatrixcomplex.sod"); +HMC_reference(1,1,1,1:2)=[1+%i 2*2*%i]; +assert_checkequal(HMC,HMC_reference); + +// int + +emptyint8matrix_ref = int8([]); +int8scalar_ref = int8(1); +int8rowvector_ref = int8([1 -4 7]); +int8colvector_ref = int8([1;-4;7]); +int8matrix_ref = int8([1 -4 7;-9 6 -3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/int8.sod"); +assert_checkequal(emptyint8matrix, emptyint8matrix_ref); +assert_checkequal(int8scalar, int8scalar_ref); +assert_checkequal(int8rowvector, int8rowvector_ref); +assert_checkequal(int8colvector, int8colvector_ref); +assert_checkequal(int8matrix, int8matrix_ref); + + +emptyint16matrix_ref = int16([]); +int16scalar_ref = int16(1); +int16rowvector_ref = int16([1 -4 7]); +int16colvector_ref = int16([1;-4;7]); +int16matrix_ref = int16([1 -4 7;-9 6 -3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/int16.sod"); +assert_checkequal(emptyint16matrix, emptyint16matrix_ref); +assert_checkequal(int16scalar, int16scalar_ref); +assert_checkequal(int16rowvector, int16rowvector_ref); +assert_checkequal(int16colvector, int16colvector_ref); +assert_checkequal(int16matrix, int16matrix_ref); + + +emptyint32matrix_ref = int32([]); +int32scalar_ref = int32(1); +int32rowvector_ref = int32([1 -4 7]); +int32colvector_ref = int32([1;-4;7]); +int32matrix_ref = int32([1 -4 7;-9 6 -3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/int32.sod"); +assert_checkequal(emptyint32matrix, emptyint32matrix_ref); +assert_checkequal(int32scalar, int32scalar_ref); +assert_checkequal(int32rowvector, int32rowvector_ref); +assert_checkequal(int32colvector, int32colvector_ref); +assert_checkequal(int32matrix, int32matrix_ref); + + +emptyuint8matrix_ref = uint8([]); +uint8scalar_ref = uint8(1); +uint8rowvector_ref = uint8([1 4 7]); +uint8colvector_ref = uint8([1;4;7]); +uint8matrix_ref = uint8([1 4 7;9 6 3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/uint8.sod"); +assert_checkequal(emptyuint8matrix, emptyuint8matrix_ref); +assert_checkequal(uint8scalar, uint8scalar_ref); +assert_checkequal(uint8rowvector, uint8rowvector_ref); +assert_checkequal(uint8colvector, uint8colvector_ref); +assert_checkequal(uint8matrix, uint8matrix_ref); + + +emptyuint16matrix_ref = uint16([]); +uint16scalar_ref = uint16(1); +uint16rowvector_ref = uint16([1 4 7]); +uint16colvector_ref = uint16([1;4;7]); +uint16matrix_ref = uint16([1 4 7;9 6 3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/uint16.sod"); +assert_checkequal(emptyuint16matrix, emptyuint16matrix_ref); +assert_checkequal(uint16scalar, uint16scalar_ref); +assert_checkequal(uint16rowvector, uint16rowvector_ref); +assert_checkequal(uint16colvector, uint16colvector_ref); +assert_checkequal(uint16matrix, uint16matrix_ref); + + +emptyuint32matrix_ref = uint32([]); +uint32scalar_ref = uint32(1); +uint32rowvector_ref = uint32([1 4 7]); +uint32colvector_ref = uint32([1;4;7]); +uint32matrix_ref = uint32([1 4 7;9 6 3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/uint32.sod"); +assert_checkequal(emptyuint32matrix, emptyuint32matrix_ref); +assert_checkequal(uint32scalar, uint32scalar_ref); +assert_checkequal(uint32rowvector, uint32rowvector_ref); +assert_checkequal(uint32colvector, uint32colvector_ref); +assert_checkequal(uint32matrix, uint32matrix_ref); + + +// undefined +undefinedelement_ref=list(2,%i,'f',ones(3,3)); +undefinedelement_ref(6)="toto"; +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/undefinedelement.sod"); +assert_checkequal(undefinedelement, undefinedelement_ref); + + +// void +voidelement_ref=list(1,,3); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/voidelement.sod"); +// Commented because of bug 9529 +//assert_checkequal(voidelement, voidelement_ref); + diff --git a/modules/hdf5/tests/unit_tests/loadhdf5data_v1.dia.ref b/modules/hdf5/tests/unit_tests/loadhdf5data_v1.dia.ref new file mode 100755 index 000000000..3775657f6 --- /dev/null +++ b/modules/hdf5/tests/unit_tests/loadhdf5data_v1.dia.ref @@ -0,0 +1,146 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Sylvestre LEDRU +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +// Load previously saved data (check backward compatibility) +///// Double +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricedoublescalar_v1.sod"); +assert_checkequal(ascalar,42); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricedouble_v1.sod"); +assert_checkequal(a,[2,3;4,5]); +///// Double complex +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricedoublecomplex_v1.sod"); +assert_checkequal(b,[2+%i,3+%i*2;4+%i*%pi,5]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricedoublecomplexscalar_v1.sod"); +assert_checkequal(bscalar,42+%i); +///// String +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricestring_v1.sod"); +assert_checkequal(c,["my matrix","of strings";"is","saved in Scilab data format"]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricestringscalar_v1.sod"); +assert_checkequal(cscalar,["my single string"]); +// Polynomials +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/polynomials_v1.sod"); +p_reference=poly([1 2],'s') ; +assert_checkequal(p,p_reference); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/polynomialscoef_v1.sod"); +q_reference=poly([1 42],'s','c'); +assert_checkequal(q,q_reference); +// Boolean matrices +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/booleanscalar_v1.sod"); +assert_checkequal(bm,%t); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/booleanmatrix_v1.sod"); +assert_checkequal(bmm,[%t,%f; %f, %t]); +// Sparse +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/sparsematrix_v1.sod"); +assert_checkequal(sp,sparse([1,2;4,5;3,10],[1,2,3])); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/emptysparse_v1.sod"); +assert_checkequal(emptysparse,sparse([])); +// boolean sparse +dense=[%F, %F, %T, %F, %F +%T, %F, %F, %F, %F +%F, %F, %F, %F, %F +%F, %F, %F, %F, %T]; +sp_reference=sparse(dense); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/booleansparse_v1.sod"); +assert_checkequal(sp,sp_reference); +// List +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/list_v1.sod"); +assert_checkequal(ls,list(2,%i,'f',ones(3,3))); +ls(2) = list( %t, [32,42]); // alter ls to add the list +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/listnested_v1.sod"); +assert_checkequal(lsnested,ls); +// tlist +lst_reference = tlist(['random numbers';'Name';'Example'], 'Uniform',ones(1,2, 3)); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/tlist_v1.sod"); +assert_checkequal(lst,lst_reference); +// mlist +M_ref=mlist(['V','name','value'],['a','b';'c' 'd'],[1 2; 3 4]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/mlist_v1.sod"); +// Commented because of bug 9531 +//assert_checkequal(M_ref,M); +// hypermatrices +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/hypermatrix_v1.sod"); +assert_checkequal(HM,hypermat([2 3 2 2],1:24)); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/hypermatrixcomplex_v1.sod"); +HMC_reference(1,1,1,1:2)=[1+%i 2*2*%i]; +assert_checkequal(HMC,HMC_reference); +// int +emptyint8matrix_ref = int8([]); +int8scalar_ref = int8(1); +int8rowvector_ref = int8([1 -4 7]); +int8colvector_ref = int8([1;-4;7]); +int8matrix_ref = int8([1 -4 7;-9 6 -3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/int8_v1.sod"); +assert_checkequal(emptyint8matrix, emptyint8matrix_ref); +assert_checkequal(int8scalar, int8scalar_ref); +assert_checkequal(int8rowvector, int8rowvector_ref); +assert_checkequal(int8colvector, int8colvector_ref); +assert_checkequal(int8matrix, int8matrix_ref); +emptyint16matrix_ref = int16([]); +int16scalar_ref = int16(1); +int16rowvector_ref = int16([1 -4 7]); +int16colvector_ref = int16([1;-4;7]); +int16matrix_ref = int16([1 -4 7;-9 6 -3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/int16_v1.sod"); +assert_checkequal(emptyint16matrix, emptyint16matrix_ref); +assert_checkequal(int16scalar, int16scalar_ref); +assert_checkequal(int16rowvector, int16rowvector_ref); +assert_checkequal(int16colvector, int16colvector_ref); +assert_checkequal(int16matrix, int16matrix_ref); +emptyint32matrix_ref = int32([]); +int32scalar_ref = int32(1); +int32rowvector_ref = int32([1 -4 7]); +int32colvector_ref = int32([1;-4;7]); +int32matrix_ref = int32([1 -4 7;-9 6 -3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/int32_v1.sod"); +assert_checkequal(emptyint32matrix, emptyint32matrix_ref); +assert_checkequal(int32scalar, int32scalar_ref); +assert_checkequal(int32rowvector, int32rowvector_ref); +assert_checkequal(int32colvector, int32colvector_ref); +assert_checkequal(int32matrix, int32matrix_ref); +emptyuint8matrix_ref = uint8([]); +uint8scalar_ref = uint8(1); +uint8rowvector_ref = uint8([1 4 7]); +uint8colvector_ref = uint8([1;4;7]); +uint8matrix_ref = uint8([1 4 7;9 6 3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/uint8_v1.sod"); +assert_checkequal(emptyuint8matrix, emptyuint8matrix_ref); +assert_checkequal(uint8scalar, uint8scalar_ref); +assert_checkequal(uint8rowvector, uint8rowvector_ref); +assert_checkequal(uint8colvector, uint8colvector_ref); +assert_checkequal(uint8matrix, uint8matrix_ref); +emptyuint16matrix_ref = uint16([]); +uint16scalar_ref = uint16(1); +uint16rowvector_ref = uint16([1 4 7]); +uint16colvector_ref = uint16([1;4;7]); +uint16matrix_ref = uint16([1 4 7;9 6 3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/uint16_v1.sod"); +assert_checkequal(emptyuint16matrix, emptyuint16matrix_ref); +assert_checkequal(uint16scalar, uint16scalar_ref); +assert_checkequal(uint16rowvector, uint16rowvector_ref); +assert_checkequal(uint16colvector, uint16colvector_ref); +assert_checkequal(uint16matrix, uint16matrix_ref); +emptyuint32matrix_ref = uint32([]); +uint32scalar_ref = uint32(1); +uint32rowvector_ref = uint32([1 4 7]); +uint32colvector_ref = uint32([1;4;7]); +uint32matrix_ref = uint32([1 4 7;9 6 3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/uint32_v1.sod"); +assert_checkequal(emptyuint32matrix, emptyuint32matrix_ref); +assert_checkequal(uint32scalar, uint32scalar_ref); +assert_checkequal(uint32rowvector, uint32rowvector_ref); +assert_checkequal(uint32colvector, uint32colvector_ref); +assert_checkequal(uint32matrix, uint32matrix_ref); +// undefined +undefinedelement_ref=list(2,%i,'f',ones(3,3)); +undefinedelement_ref(6)="toto"; +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/undefinedelement_v1.sod"); +assert_checkequal(undefinedelement, undefinedelement_ref); +// void +voidelement_ref=list(1,,3); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/voidelement_v1.sod"); +// Commented because of bug 9529 +//assert_checkequal(voidelement, voidelement_ref); diff --git a/modules/hdf5/tests/unit_tests/loadhdf5data_v1.tst b/modules/hdf5/tests/unit_tests/loadhdf5data_v1.tst new file mode 100755 index 000000000..89e3e73bf --- /dev/null +++ b/modules/hdf5/tests/unit_tests/loadhdf5data_v1.tst @@ -0,0 +1,186 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Sylvestre LEDRU +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> + +// Load previously saved data (check backward compatibility) + + +///// Double +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricedoublescalar_v1.sod"); +assert_checkequal(ascalar,42); + +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricedouble_v1.sod"); +assert_checkequal(a,[2,3;4,5]); + + +///// Double complex +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricedoublecomplex_v1.sod"); +assert_checkequal(b,[2+%i,3+%i*2;4+%i*%pi,5]); + +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricedoublecomplexscalar_v1.sod"); +assert_checkequal(bscalar,42+%i); + + +///// String +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricestring_v1.sod"); +assert_checkequal(c,["my matrix","of strings";"is","saved in Scilab data format"]); + +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricestringscalar_v1.sod"); +assert_checkequal(cscalar,["my single string"]); + +// Polynomials +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/polynomials_v1.sod"); +p_reference=poly([1 2],'s') ; +assert_checkequal(p,p_reference); + +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/polynomialscoef_v1.sod"); +q_reference=poly([1 42],'s','c'); +assert_checkequal(q,q_reference); + + +// Boolean matrices +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/booleanscalar_v1.sod"); +assert_checkequal(bm,%t); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/booleanmatrix_v1.sod"); +assert_checkequal(bmm,[%t,%f; %f, %t]); + +// Sparse +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/sparsematrix_v1.sod"); +assert_checkequal(sp,sparse([1,2;4,5;3,10],[1,2,3])); + +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/emptysparse_v1.sod"); +assert_checkequal(emptysparse,sparse([])); + +// boolean sparse +dense=[%F, %F, %T, %F, %F +%T, %F, %F, %F, %F +%F, %F, %F, %F, %F +%F, %F, %F, %F, %T]; +sp_reference=sparse(dense); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/booleansparse_v1.sod"); +assert_checkequal(sp,sp_reference); + +// List +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/list_v1.sod"); +assert_checkequal(ls,list(2,%i,'f',ones(3,3))); +ls(2) = list( %t, [32,42]); // alter ls to add the list +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/listnested_v1.sod"); +assert_checkequal(lsnested,ls); + +// tlist +lst_reference = tlist(['random numbers';'Name';'Example'], 'Uniform',ones(1,2, 3)); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/tlist_v1.sod"); +assert_checkequal(lst,lst_reference); + +// mlist +M_ref=mlist(['V','name','value'],['a','b';'c' 'd'],[1 2; 3 4]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/mlist_v1.sod"); +// Commented because of bug 9531 +//assert_checkequal(M_ref,M); + +// hypermatrices +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/hypermatrix_v1.sod"); +assert_checkequal(HM,hypermat([2 3 2 2],1:24)); + +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/hypermatrixcomplex_v1.sod"); +HMC_reference(1,1,1,1:2)=[1+%i 2*2*%i]; +assert_checkequal(HMC,HMC_reference); + +// int + +emptyint8matrix_ref = int8([]); +int8scalar_ref = int8(1); +int8rowvector_ref = int8([1 -4 7]); +int8colvector_ref = int8([1;-4;7]); +int8matrix_ref = int8([1 -4 7;-9 6 -3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/int8_v1.sod"); +assert_checkequal(emptyint8matrix, emptyint8matrix_ref); +assert_checkequal(int8scalar, int8scalar_ref); +assert_checkequal(int8rowvector, int8rowvector_ref); +assert_checkequal(int8colvector, int8colvector_ref); +assert_checkequal(int8matrix, int8matrix_ref); + + +emptyint16matrix_ref = int16([]); +int16scalar_ref = int16(1); +int16rowvector_ref = int16([1 -4 7]); +int16colvector_ref = int16([1;-4;7]); +int16matrix_ref = int16([1 -4 7;-9 6 -3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/int16_v1.sod"); +assert_checkequal(emptyint16matrix, emptyint16matrix_ref); +assert_checkequal(int16scalar, int16scalar_ref); +assert_checkequal(int16rowvector, int16rowvector_ref); +assert_checkequal(int16colvector, int16colvector_ref); +assert_checkequal(int16matrix, int16matrix_ref); + + +emptyint32matrix_ref = int32([]); +int32scalar_ref = int32(1); +int32rowvector_ref = int32([1 -4 7]); +int32colvector_ref = int32([1;-4;7]); +int32matrix_ref = int32([1 -4 7;-9 6 -3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/int32_v1.sod"); +assert_checkequal(emptyint32matrix, emptyint32matrix_ref); +assert_checkequal(int32scalar, int32scalar_ref); +assert_checkequal(int32rowvector, int32rowvector_ref); +assert_checkequal(int32colvector, int32colvector_ref); +assert_checkequal(int32matrix, int32matrix_ref); + + +emptyuint8matrix_ref = uint8([]); +uint8scalar_ref = uint8(1); +uint8rowvector_ref = uint8([1 4 7]); +uint8colvector_ref = uint8([1;4;7]); +uint8matrix_ref = uint8([1 4 7;9 6 3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/uint8_v1.sod"); +assert_checkequal(emptyuint8matrix, emptyuint8matrix_ref); +assert_checkequal(uint8scalar, uint8scalar_ref); +assert_checkequal(uint8rowvector, uint8rowvector_ref); +assert_checkequal(uint8colvector, uint8colvector_ref); +assert_checkequal(uint8matrix, uint8matrix_ref); + + +emptyuint16matrix_ref = uint16([]); +uint16scalar_ref = uint16(1); +uint16rowvector_ref = uint16([1 4 7]); +uint16colvector_ref = uint16([1;4;7]); +uint16matrix_ref = uint16([1 4 7;9 6 3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/uint16_v1.sod"); +assert_checkequal(emptyuint16matrix, emptyuint16matrix_ref); +assert_checkequal(uint16scalar, uint16scalar_ref); +assert_checkequal(uint16rowvector, uint16rowvector_ref); +assert_checkequal(uint16colvector, uint16colvector_ref); +assert_checkequal(uint16matrix, uint16matrix_ref); + + +emptyuint32matrix_ref = uint32([]); +uint32scalar_ref = uint32(1); +uint32rowvector_ref = uint32([1 4 7]); +uint32colvector_ref = uint32([1;4;7]); +uint32matrix_ref = uint32([1 4 7;9 6 3]); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/uint32_v1.sod"); +assert_checkequal(emptyuint32matrix, emptyuint32matrix_ref); +assert_checkequal(uint32scalar, uint32scalar_ref); +assert_checkequal(uint32rowvector, uint32rowvector_ref); +assert_checkequal(uint32colvector, uint32colvector_ref); +assert_checkequal(uint32matrix, uint32matrix_ref); + + +// undefined +undefinedelement_ref=list(2,%i,'f',ones(3,3)); +undefinedelement_ref(6)="toto"; +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/undefinedelement_v1.sod"); +assert_checkequal(undefinedelement, undefinedelement_ref); + + +// void +voidelement_ref=list(1,,3); +import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/voidelement_v1.sod"); +// Commented because of bug 9529 +//assert_checkequal(voidelement, voidelement_ref); + |