summaryrefslogtreecommitdiff
path: root/modules/matio/tests
diff options
context:
space:
mode:
authorShashank2017-05-29 12:40:26 +0530
committerShashank2017-05-29 12:40:26 +0530
commit0345245e860375a32c9a437c4a9d9cae807134e9 (patch)
treead51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /modules/matio/tests
downloadscilab_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/matio/tests')
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_11035.dia.ref18
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_11035.matbin0 -> 9713 bytes
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_11035.tst19
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_12168.dia.ref23
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_12168.tst25
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_12170.dia.ref41
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_12170.tst46
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_13102.dia.ref30
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_13102.tst37
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_2731.dia.ref17
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_2731.tst20
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_3674.dia.ref51
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_3674.tst71
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_3780.dia.ref30
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_3780.tst37
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_3780.txt9
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_4926.dia.ref26
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_4926.tst25
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_5462.dia.ref24
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_5462.tst25
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_5466.dia.ref31
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_5466.tst34
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_7862.dia.ref57
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_7862.tst57
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_8783.dia.ref143
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_8783.matbin0 -> 1093 bytes
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_8783.tst156
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_8828.dia.ref19
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_8828.tst20
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_9354.dia.ref27
-rwxr-xr-xmodules/matio/tests/nonreg_tests/bug_9354.tst30
-rwxr-xr-xmodules/matio/tests/nonreg_tests/t-circle.matbin0 -> 3868071 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/arraycell-v6.matbin0 -> 10600 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/arraycell-v7.matbin0 -> 395 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/arraystruct-v6.matbin0 -> 1568 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/arraystruct-v7.matbin0 -> 383 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/colcell-v6.matbin0 -> 424 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/colcell-v7.matbin0 -> 263 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/colstruct-v6.matbin0 -> 824 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/colstruct-v7.matbin0 -> 353 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/complexdoubleNDarray-v6.matbin0 -> 272 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/complexdoubleNDarray-v7.matbin0 -> 228 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/cplxdoublecolvector-v4.matbin0 -> 88 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/cplxdoublecolvector-v6.matbin0 -> 264 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/cplxdoublecolvector-v7.matbin0 -> 228 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/cplxdoublematrix-v4.matbin0 -> 133 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/cplxdoublematrix-v6.matbin0 -> 304 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/cplxdoublematrix-v7.matbin0 -> 243 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/cplxdoublerowvector-v4.matbin0 -> 88 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/cplxdoublerowvector-v6.matbin0 -> 264 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/cplxdoublerowvector-v7.matbin0 -> 229 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/cplxdoublescalar-v4.matbin0 -> 53 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/cplxdoublescalar-v6.matbin0 -> 224 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/cplxdoublescalar-v7.matbin0 -> 204 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptyNDarray-v6.matbin0 -> 208 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptyNDarray-v7.matbin0 -> 183 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptycell-v6.matbin0 -> 192 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptycell-v7.matbin0 -> 178 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptydoublematrix-v4.matbin0 -> 38 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptydoublematrix-v6.matbin0 -> 208 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptydoublematrix-v7.matbin0 -> 188 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptyint16matrix-v6.matbin0 -> 200 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptyint16matrix-v7.matbin0 -> 187 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptyint32matrix-v6.matbin0 -> 200 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptyint32matrix-v7.matbin0 -> 187 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptyint8matrix-v6.matbin0 -> 200 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptyint8matrix-v7.matbin0 -> 184 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptysparse-v6.matbin0 -> 216 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptysparse-v7.matbin0 -> 190 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptystringmatrix-v4.matbin0 -> 38 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptystringmatrix-v6.matbin0 -> 208 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptystringmatrix-v7.matbin0 -> 188 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptystruct-v6.matbin0 -> 208 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptystruct-v7.matbin0 -> 184 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptyuint16matrix-v6.matbin0 -> 208 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptyuint16matrix-v7.matbin0 -> 189 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptyuint32matrix-v6.matbin0 -> 208 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptyuint32matrix-v7.matbin0 -> 189 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptyuint8matrix-v6.matbin0 -> 200 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/emptyuint8matrix-v7.matbin0 -> 187 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/eye100x100-v4.matbin0 -> 80031 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/eye100x100-v6.matbin0 -> 10200 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/eye100x100-v7.matbin0 -> 264 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int16colvector-v6.matbin0 -> 208 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int16colvector-v7.matbin0 -> 193 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int16matrix-v6.matbin0 -> 216 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int16matrix-v7.matbin0 -> 202 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int16rowvector-v6.matbin0 -> 208 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int16rowvector-v7.matbin0 -> 193 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int16scalar-v6.matbin0 -> 200 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int16scalar-v7.matbin0 -> 184 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int32colvector-v6.matbin0 -> 216 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int32colvector-v7.matbin0 -> 195 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int32matrix-v6.matbin0 -> 224 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int32matrix-v7.matbin0 -> 202 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int32rowvector-v6.matbin0 -> 216 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int32rowvector-v7.matbin0 -> 195 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int32scalar-v6.matbin0 -> 200 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int32scalar-v7.matbin0 -> 182 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int8colvector-v6.matbin0 -> 200 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int8colvector-v7.matbin0 -> 188 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int8matrix-v6.matbin0 -> 208 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int8matrix-v7.matbin0 -> 193 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int8rowvector-v6.matbin0 -> 200 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int8rowvector-v7.matbin0 -> 188 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int8scalar-v6.matbin0 -> 200 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/int8scalar-v7.matbin0 -> 181 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/loadmatfile.dia.ref475
-rwxr-xr-xmodules/matio/tests/unit_tests/loadmatfile.tst252
-rwxr-xr-xmodules/matio/tests/unit_tests/matfile_close.dia.ref19
-rwxr-xr-xmodules/matio/tests/unit_tests/matfile_close.tst21
-rwxr-xr-xmodules/matio/tests/unit_tests/matfile_listvar.dia.ref30
-rwxr-xr-xmodules/matio/tests/unit_tests/matfile_listvar.tst36
-rwxr-xr-xmodules/matio/tests/unit_tests/matfile_open.dia.ref17
-rwxr-xr-xmodules/matio/tests/unit_tests/matfile_open.tst20
-rwxr-xr-xmodules/matio/tests/unit_tests/matfile_varreadnext.dia.ref31
-rwxr-xr-xmodules/matio/tests/unit_tests/matfile_varreadnext.tst39
-rwxr-xr-xmodules/matio/tests/unit_tests/matfile_varwrite.dia.ref21
-rwxr-xr-xmodules/matio/tests/unit_tests/matfile_varwrite.tst25
-rwxr-xr-xmodules/matio/tests/unit_tests/realcolvectorsparse-v6.matbin0 -> 256 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/realcolvectorsparse-v7.matbin0 -> 221 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/realdoubleNDarray-v6.matbin0 -> 240 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/realdoubleNDarray-v7.matbin0 -> 222 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/realdoublecolvector-v4.matbin0 -> 64 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/realdoublecolvector-v6.matbin0 -> 232 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/realdoublecolvector-v7.matbin0 -> 218 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/realdoublematrix-v4.matbin0 -> 85 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/realdoublematrix-v6.matbin0 -> 248 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/realdoublematrix-v7.matbin0 -> 231 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/realdoublerowvector-v4.matbin0 -> 64 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/realdoublerowvector-v6.matbin0 -> 232 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/realdoublerowvector-v7.matbin0 -> 218 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/realdoublescalar-v4.matbin0 -> 45 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/realdoublescalar-v6.matbin0 -> 208 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/realdoublescalar-v7.matbin0 -> 192 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/realmatrixsparse-v6.matbin0 -> 280 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/realmatrixsparse-v7.matbin0 -> 235 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/realrowvectorsparse-v6.matbin0 -> 264 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/realrowvectorsparse-v7.matbin0 -> 225 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/realscalarsparse-v6.matbin0 -> 232 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/realscalarsparse-v7.matbin0 -> 205 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/rowcell-v6.matbin0 -> 424 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/rowcell-v7.matbin0 -> 256 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/rowstruct-v6.matbin0 -> 824 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/rowstruct-v7.matbin0 -> 340 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/savematfile.dia.ref179
-rwxr-xr-xmodules/matio/tests/unit_tests/savematfile.tst218
-rwxr-xr-xmodules/matio/tests/unit_tests/scalarcell-v6.matbin0 -> 256 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/scalarcell-v7.matbin0 -> 199 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/scalarstruct-v6.matbin0 -> 416 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/scalarstruct-v7.matbin0 -> 252 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/stringcell-v6.matbin0 -> 576 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/stringcell-v7.matbin0 -> 231 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/stringcolvector-v4.matbin0 -> 60 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/stringcolvector-v6.matbin0 -> 208 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/stringcolvector-v7.matbin0 -> 192 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/stringmatrix-v4.matbin0 -> 81 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/stringmatrix-v6.matbin0 -> 216 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/stringmatrix-v7.matbin0 -> 195 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/stringrowvector-v4.matbin0 -> 60 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/stringrowvector-v6.matbin0 -> 208 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/stringrowvector-v7.matbin0 -> 192 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/stringscalar-v4.matbin0 -> 41 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/stringscalar-v6.matbin0 -> 200 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/stringscalar-v7.matbin0 -> 186 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/testmatfiles.m204
-rwxr-xr-xmodules/matio/tests/unit_tests/uint16colvector-v6.matbin0 -> 208 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint16colvector-v7.matbin0 -> 192 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint16matrix-v6.matbin0 -> 216 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint16matrix-v7.matbin0 -> 196 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint16rowvector-v6.matbin0 -> 208 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint16rowvector-v7.matbin0 -> 192 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint16scalar-v6.matbin0 -> 200 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint16scalar-v7.matbin0 -> 185 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint32colvector-v6.matbin0 -> 216 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint32colvector-v7.matbin0 -> 193 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint32matrix-v6.matbin0 -> 224 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint32matrix-v7.matbin0 -> 195 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint32rowvector-v6.matbin0 -> 216 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint32rowvector-v7.matbin0 -> 193 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint32scalar-v6.matbin0 -> 200 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint32scalar-v7.matbin0 -> 184 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint8colvector-v6.matbin0 -> 200 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint8colvector-v7.matbin0 -> 192 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint8matrix-v6.matbin0 -> 208 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint8matrix-v7.matbin0 -> 193 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint8rowvector-v6.matbin0 -> 200 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint8rowvector-v7.matbin0 -> 192 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint8scalar-v6.matbin0 -> 200 bytes
-rwxr-xr-xmodules/matio/tests/unit_tests/uint8scalar-v7.matbin0 -> 184 bytes
190 files changed, 2735 insertions, 0 deletions
diff --git a/modules/matio/tests/nonreg_tests/bug_11035.dia.ref b/modules/matio/tests/nonreg_tests/bug_11035.dia.ref
new file mode 100755
index 000000000..1a7e8dc9f
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_11035.dia.ref
@@ -0,0 +1,18 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Charlotte HECQUET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 11035 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=11035
+//
+// <-- Short Description -->
+// Scilab crashes when loading a mat file created with Matlab 7.12
+path_file = fullfile(SCI, "modules","matio","tests","nonreg_tests","bug_11035.mat");
+assert_checktrue(execstr("loadmatfile(path_file)","errcatch") == 0);
diff --git a/modules/matio/tests/nonreg_tests/bug_11035.mat b/modules/matio/tests/nonreg_tests/bug_11035.mat
new file mode 100755
index 000000000..c4ed1deef
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_11035.mat
Binary files differ
diff --git a/modules/matio/tests/nonreg_tests/bug_11035.tst b/modules/matio/tests/nonreg_tests/bug_11035.tst
new file mode 100755
index 000000000..8fdd777ad
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_11035.tst
@@ -0,0 +1,19 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Charlotte HECQUET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 11035 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=11035
+//
+// <-- Short Description -->
+// Scilab crashes when loading a mat file created with Matlab 7.12
+
+path_file = fullfile(SCI, "modules","matio","tests","nonreg_tests","bug_11035.mat");
+assert_checktrue(execstr("loadmatfile(path_file)","errcatch") == 0);
diff --git a/modules/matio/tests/nonreg_tests/bug_12168.dia.ref b/modules/matio/tests/nonreg_tests/bug_12168.dia.ref
new file mode 100755
index 000000000..bed0857a8
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_12168.dia.ref
@@ -0,0 +1,23 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Scilab Enterprises - Vincent COUVERT
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 12168 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=12168
+//
+// <-- Short Description -->
+// Segfault when listing a closed matfile.
+A = rand(10,10);
+testfile = fullfile(TMPDIR, "bug_12168.mat");
+savematfile(testfile, "A", "-v6");
+fd = matfile_open(testfile);
+matfile_close(fd);
+refMsg = msprintf(_("%s: Invalid file identifier.\n"), "matfile_listvar");
+assert_checkerror("matfile_listvar(fd);", refMsg);
diff --git a/modules/matio/tests/nonreg_tests/bug_12168.tst b/modules/matio/tests/nonreg_tests/bug_12168.tst
new file mode 100755
index 000000000..478def49a
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_12168.tst
@@ -0,0 +1,25 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Scilab Enterprises - Vincent COUVERT
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 12168 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=12168
+//
+// <-- Short Description -->
+// Segfault when listing a closed matfile.
+
+
+A = rand(10,10);
+testfile = fullfile(TMPDIR, "bug_12168.mat");
+savematfile(testfile, "A", "-v6");
+fd = matfile_open(testfile);
+matfile_close(fd);
+refMsg = msprintf(_("%s: Invalid file identifier.\n"), "matfile_listvar");
+assert_checkerror("matfile_listvar(fd);", refMsg);
diff --git a/modules/matio/tests/nonreg_tests/bug_12170.dia.ref b/modules/matio/tests/nonreg_tests/bug_12170.dia.ref
new file mode 100755
index 000000000..ffe7aa72b
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_12170.dia.ref
@@ -0,0 +1,41 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Pierre-Aime Agnel
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 12170 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=12170
+//
+// <-- Short Description -->
+// matfile_open with option "w" causes matfile_listvar error
+A = rand(10,10);
+B = sprand(100,100,0.1);
+C = "foo";
+D = "bar";
+filename=TMPDIR+"/test_matfile.mat";
+savematfile(filename,'A','B','C','D','-v6');
+clear();
+filename=TMPDIR+"/test_matfile.mat";
+//Open files in different modes
+fd = matfile_open(filename, "w");
+//Checking if matfile_listvar generates an error on a "w" opened file
+if execstr('[name, classes, types]=matfile_listvar(fd)','errcatch','n')<>0
+ genErr = %t //matfile_listvar generated an error
+else
+ genErr = %f //matfile_listvar did not generate an error
+ genErr =
+
+ F
+end
+assert_checkfalse(genErr);
+assert_checkequal(matfile_close(fd), %t);
+//Listvar on an empty file should not give error but empty matrices
+assert_checktrue(isempty(name));
+assert_checktrue(isempty(classes));
+assert_checktrue(isempty(types));
diff --git a/modules/matio/tests/nonreg_tests/bug_12170.tst b/modules/matio/tests/nonreg_tests/bug_12170.tst
new file mode 100755
index 000000000..9bb734517
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_12170.tst
@@ -0,0 +1,46 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Pierre-Aime Agnel
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 12170 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=12170
+//
+// <-- Short Description -->
+// matfile_open with option "w" causes matfile_listvar error
+
+
+A = rand(10,10);
+B = sprand(100,100,0.1);
+C = "foo";
+D = "bar";
+
+filename=TMPDIR+"/test_matfile.mat";
+savematfile(filename,'A','B','C','D','-v6');
+
+clear();
+
+filename=TMPDIR+"/test_matfile.mat";
+//Open files in different modes
+fd = matfile_open(filename, "w");
+
+//Checking if matfile_listvar generates an error on a "w" opened file
+if execstr('[name, classes, types]=matfile_listvar(fd)','errcatch','n')<>0
+ genErr = %t //matfile_listvar generated an error
+else
+ genErr = %f //matfile_listvar did not generate an error
+end
+
+assert_checkfalse(genErr);
+assert_checkequal(matfile_close(fd), %t);
+
+//Listvar on an empty file should not give error but empty matrices
+assert_checktrue(isempty(name));
+assert_checktrue(isempty(classes));
+assert_checktrue(isempty(types));
diff --git a/modules/matio/tests/nonreg_tests/bug_13102.dia.ref b/modules/matio/tests/nonreg_tests/bug_13102.dia.ref
new file mode 100755
index 000000000..c1c43b154
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_13102.dia.ref
@@ -0,0 +1,30 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Paul Bignier
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 13102 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=13102
+//
+// <-- Short Description -->
+// savematfile did not support "-v7.3" option.
+A = rand(10,10);
+testfile = fullfile(TMPDIR, "bug_13102.mat");
+savematfile(testfile, "A", "-v7.3");
+refA = A;
+clear A;
+loadmatfile(testfile);
+assert_checkequal(refA, A);
+deletefile(testfile);
+// Create an empty Matlab 7.3 file ready for writing
+fd = matfile_open(testfile, "w", "7.3");
+assert_checkequal(fd, 0);
+matfile_close(fd);
+assert_checktrue(isfile(testfile));
+deletefile(testfile);
diff --git a/modules/matio/tests/nonreg_tests/bug_13102.tst b/modules/matio/tests/nonreg_tests/bug_13102.tst
new file mode 100755
index 000000000..1260cfa0d
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_13102.tst
@@ -0,0 +1,37 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Paul Bignier
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 13102 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=13102
+//
+// <-- Short Description -->
+// savematfile did not support "-v7.3" option.
+
+A = rand(10,10);
+
+testfile = fullfile(TMPDIR, "bug_13102.mat");
+savematfile(testfile, "A", "-v7.3");
+
+refA = A;
+clear A;
+
+loadmatfile(testfile);
+assert_checkequal(refA, A);
+deletefile(testfile);
+
+
+// Create an empty Matlab 7.3 file ready for writing
+fd = matfile_open(testfile, "w", "7.3");
+assert_checkequal(fd, 0);
+
+matfile_close(fd);
+assert_checktrue(isfile(testfile));
+deletefile(testfile);
diff --git a/modules/matio/tests/nonreg_tests/bug_2731.dia.ref b/modules/matio/tests/nonreg_tests/bug_2731.dia.ref
new file mode 100755
index 000000000..3f0cecbb0
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_2731.dia.ref
@@ -0,0 +1,17 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008-2008 - DIGITEO - Simon LIPP <simon.lipp@inria.fr>
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- Non-regression test for bug 2731 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=2731
+//
+// <-- Short Description -->
+// On 64bit linux, the loadmatfile function does not work with v4 MAT files,
+// complaining about exceeded stacksize.
+// <-- CLI SHELL MODE -->
+ierr = execstr('loadmatfile(SCI+''/modules/matio/tests/nonreg_tests/t-circle.mat'')', 'errcatch');
+if ierr <> 0 then bugmes();quit;end
diff --git a/modules/matio/tests/nonreg_tests/bug_2731.tst b/modules/matio/tests/nonreg_tests/bug_2731.tst
new file mode 100755
index 000000000..b825cd1e1
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_2731.tst
@@ -0,0 +1,20 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008-2008 - DIGITEO - Simon LIPP <simon.lipp@inria.fr>
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- Non-regression test for bug 2731 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=2731
+//
+// <-- Short Description -->
+// On 64bit linux, the loadmatfile function does not work with v4 MAT files,
+// complaining about exceeded stacksize.
+
+// <-- CLI SHELL MODE -->
+
+ierr = execstr('loadmatfile(SCI+''/modules/matio/tests/nonreg_tests/t-circle.mat'')', 'errcatch');
+if ierr <> 0 then pause,end
diff --git a/modules/matio/tests/nonreg_tests/bug_3674.dia.ref b/modules/matio/tests/nonreg_tests/bug_3674.dia.ref
new file mode 100755
index 000000000..cade0a4fa
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_3674.dia.ref
@@ -0,0 +1,51 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Vincent COUVERT <vincent.couvert@scilab.org>
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// <-- Non-regression test for bug 3674 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=3674
+//
+// <-- Short Description -->
+// Scilab 5.0.2 has issues with the new "MAT-file Format" (functions "savematfile" and "loadmatfile") :
+// - loading a same variable from different files: the existing variables are not erased.
+// - saving file on another one is always on an appending mode: the existing files are not erased.
+//
+// Test savematfile
+//
+// Create a matrix
+M = rand(400,400);
+// Save the variable
+savematfile(TMPDIR + "/bug_3674.mat", "M", "-v6");
+// Read file size
+[x, ierr]=fileinfo(TMPDIR + "/bug_3674.mat");
+sizeFileRef = x(1);
+// Try to erase original file
+savematfile(TMPDIR + "/bug_3674.mat", "M", "-v6");
+// Compare size
+[x, ierr]=fileinfo(TMPDIR + "/bug_3674.mat");
+newSizeFile = x(1);
+if newSizeFile<>sizeFileRef then bugmes();quit;end
+// Test loadmatfile
+// Create a matrix
+M=rand(400,400);
+// Saving same var in 3 separate files
+savematfile(TMPDIR + "/bug_3674_1.mat", "M", "-v6");
+savematfile(TMPDIR + "/bug_3674_2.mat", "M", "-v6");
+savematfile(TMPDIR + "/bug_3674_3.mat", "M", "-v6");
+clear;
+allVarNames = who("get");
+if or(allVarNames=="M") then bugmes();quit;end
+execstr("loadmatfile(TMPDIR + ""/bug_3674_1.mat"");")
+allVarNames = who("get");
+if size(find(allVarNames=="M"), "*") > 1 then bugmes();quit;end
+execstr("loadmatfile(TMPDIR + ""/bug_3674_2.mat"");")
+allVarNames = who("get");
+if size(find(allVarNames=="M"), "*") > 1 then bugmes();quit;end
+execstr("loadmatfile(TMPDIR + ""/bug_3674_3.mat"");")
+allVarNames = who("get");
+if size(find(allVarNames=="M"), "*") > 1 then bugmes();quit;end
diff --git a/modules/matio/tests/nonreg_tests/bug_3674.tst b/modules/matio/tests/nonreg_tests/bug_3674.tst
new file mode 100755
index 000000000..6b4866904
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_3674.tst
@@ -0,0 +1,71 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Vincent COUVERT <vincent.couvert@scilab.org>
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+// <-- Non-regression test for bug 3674 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=3674
+//
+// <-- Short Description -->
+// Scilab 5.0.2 has issues with the new "MAT-file Format" (functions "savematfile" and "loadmatfile") :
+// - loading a same variable from different files: the existing variables are not erased.
+// - saving file on another one is always on an appending mode: the existing files are not erased.
+
+//
+// Test savematfile
+//
+
+// Create a matrix
+M = rand(400,400);
+
+// Save the variable
+savematfile(TMPDIR + "/bug_3674.mat", "M", "-v6");
+
+// Read file size
+[x, ierr]=fileinfo(TMPDIR + "/bug_3674.mat");
+sizeFileRef = x(1);
+
+// Try to erase original file
+savematfile(TMPDIR + "/bug_3674.mat", "M", "-v6");
+
+// Compare size
+[x, ierr]=fileinfo(TMPDIR + "/bug_3674.mat");
+newSizeFile = x(1);
+
+if newSizeFile<>sizeFileRef then pause;end
+
+
+// Test loadmatfile
+
+// Create a matrix
+M=rand(400,400);
+
+// Saving same var in 3 separate files
+savematfile(TMPDIR + "/bug_3674_1.mat", "M", "-v6");
+savematfile(TMPDIR + "/bug_3674_2.mat", "M", "-v6");
+savematfile(TMPDIR + "/bug_3674_3.mat", "M", "-v6");
+
+clear;
+
+allVarNames = who("get");
+if or(allVarNames=="M") then pause;end
+
+execstr("loadmatfile(TMPDIR + ""/bug_3674_1.mat"");")
+allVarNames = who("get");
+if size(find(allVarNames=="M"), "*") > 1 then pause;end
+
+execstr("loadmatfile(TMPDIR + ""/bug_3674_2.mat"");")
+allVarNames = who("get");
+if size(find(allVarNames=="M"), "*") > 1 then pause;end
+
+execstr("loadmatfile(TMPDIR + ""/bug_3674_3.mat"");")
+allVarNames = who("get");
+if size(find(allVarNames=="M"), "*") > 1 then pause;end
+
+
diff --git a/modules/matio/tests/nonreg_tests/bug_3780.dia.ref b/modules/matio/tests/nonreg_tests/bug_3780.dia.ref
new file mode 100755
index 000000000..e8aae9231
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_3780.dia.ref
@@ -0,0 +1,30 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Vincent COUVERT
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- Non-regression test for bug 3780 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=3780
+//
+// <-- Short Description -->
+// The function loadmatfile does not ignore comments found in ASCII files while loading them, resulting in an error message.
+// Moreover, for Matlab compatibility, when this function is called with one input argument load(filename), it must look for filename (as a binary file), filename.mat (as a binary file) or as an ASCII file otherwise.
+// Check that comment are ignored
+// <-- CLI SHELL MODE -->
+loadmatfile("SCI/modules/matio/tests/nonreg_tests/bug_3780.txt", "-ascii");
+if ~exists("bug_3780", "local") then bugmes();quit;end
+refvalue = [0,1,2,3,4;
+ 10,11,12,13,14;
+ 20,21,22,23,24;
+ 30,31,32,33,34;
+ 40,41,42,43,44;
+ 50,51,52,53,54;
+ 30,61,62,63,64];
+if or(bug_3780<>refvalue) then bugmes();quit;end
+clear bug_3780
+// Check that loadmatfile can be call with an ASCII file without -ascii option
+loadmatfile("SCI/modules/matio/tests/nonreg_tests/bug_3780.txt");
+if or(bug_3780<>refvalue) then bugmes();quit;end
diff --git a/modules/matio/tests/nonreg_tests/bug_3780.tst b/modules/matio/tests/nonreg_tests/bug_3780.tst
new file mode 100755
index 000000000..72478f45b
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_3780.tst
@@ -0,0 +1,37 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Vincent COUVERT
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- Non-regression test for bug 3780 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=3780
+//
+// <-- Short Description -->
+// The function loadmatfile does not ignore comments found in ASCII files while loading them, resulting in an error message.
+// Moreover, for Matlab compatibility, when this function is called with one input argument load(filename), it must look for filename (as a binary file), filename.mat (as a binary file) or as an ASCII file otherwise.
+
+// Check that comment are ignored
+
+// <-- CLI SHELL MODE -->
+
+loadmatfile("SCI/modules/matio/tests/nonreg_tests/bug_3780.txt", "-ascii");
+
+if ~exists("bug_3780", "local") then pause;end
+refvalue = [0,1,2,3,4;
+ 10,11,12,13,14;
+ 20,21,22,23,24;
+ 30,31,32,33,34;
+ 40,41,42,43,44;
+ 50,51,52,53,54;
+ 30,61,62,63,64];
+if or(bug_3780<>refvalue) then pause;end
+
+clear bug_3780
+
+// Check that loadmatfile can be call with an ASCII file without -ascii option
+loadmatfile("SCI/modules/matio/tests/nonreg_tests/bug_3780.txt");
+if or(bug_3780<>refvalue) then pause;end
diff --git a/modules/matio/tests/nonreg_tests/bug_3780.txt b/modules/matio/tests/nonreg_tests/bug_3780.txt
new file mode 100755
index 000000000..8e8331abd
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_3780.txt
@@ -0,0 +1,9 @@
+% VAR1 VAR2 VAR3 VAR4
+0 1 2 3 4 % comment on line 2
+10 11 12 13 14
+20 21 22 23 24
+% VAR1 VAR2 VAR3 VAR4
+30 31 32 33 34
+40 41 42 43 44
+50 51 52 53 54
+30 61 62 63 64 % comment on last line
diff --git a/modules/matio/tests/nonreg_tests/bug_4926.dia.ref b/modules/matio/tests/nonreg_tests/bug_4926.dia.ref
new file mode 100755
index 000000000..c2f6a85b2
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_4926.dia.ref
@@ -0,0 +1,26 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Vincent COUVERT <vincent.couvert@scilab.org>
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- ENGLISH IMPOSED -->
+//
+// <-- Non-regression test for bug 4926 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=4926
+//
+// <-- Short Description -->
+// Can not save a structure in a MAT-file using savematfile.
+s.name = "NAME";
+s.firstname = "FIRSTNAME";
+s.age = 25;
+s.address = "TOWN";
+ierr = execstr("savematfile(TMPDIR + filesep() + ""bug_4926.tst"", ""s"")", "errcatch");
+WARNING: Option -v7 added.
+WARNING: Variable s can not be saved in ASCII file: IGNORED.
+if ierr <> 0 then bugmes();quit;end
diff --git a/modules/matio/tests/nonreg_tests/bug_4926.tst b/modules/matio/tests/nonreg_tests/bug_4926.tst
new file mode 100755
index 000000000..946edf8e6
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_4926.tst
@@ -0,0 +1,25 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Vincent COUVERT <vincent.couvert@scilab.org>
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- ENGLISH IMPOSED -->
+//
+// <-- Non-regression test for bug 4926 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=4926
+//
+// <-- Short Description -->
+// Can not save a structure in a MAT-file using savematfile.
+
+s.name = "NAME";
+s.firstname = "FIRSTNAME";
+s.age = 25;
+s.address = "TOWN";
+ierr = execstr("savematfile(TMPDIR + filesep() + ""bug_4926.tst"", ""s"")", "errcatch");
+if ierr <> 0 then pause,end
diff --git a/modules/matio/tests/nonreg_tests/bug_5462.dia.ref b/modules/matio/tests/nonreg_tests/bug_5462.dia.ref
new file mode 100755
index 000000000..8fb3d45a9
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_5462.dia.ref
@@ -0,0 +1,24 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Yann COLLETTE <yann.collette@scilab.org>
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+//
+// <-- ENGLISH IMPOSED -->
+//
+// <-- Non-regression test for bug 5462 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=5462
+//
+// <-- Short Description -->
+// Can not save correctly a sparse matrix in a MAT-file using savematfile.
+A = sprand(1000,1000,0.01);
+savematfile(TMPDIR + filesep() + "bug_5462.mat", "A");
+WARNING: Option -v7 added.
+A1 = A;
+clear A
+loadmatfile(TMPDIR + filesep() + "bug_5462.mat", "A");
+if (norm(A1 - A)>=10*%eps) then bugmes();quit;end
diff --git a/modules/matio/tests/nonreg_tests/bug_5462.tst b/modules/matio/tests/nonreg_tests/bug_5462.tst
new file mode 100755
index 000000000..5497bc451
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_5462.tst
@@ -0,0 +1,25 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Yann COLLETTE <yann.collette@scilab.org>
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+//
+// <-- ENGLISH IMPOSED -->
+//
+// <-- Non-regression test for bug 5462 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=5462
+//
+// <-- Short Description -->
+// Can not save correctly a sparse matrix in a MAT-file using savematfile.
+
+A = sprand(1000,1000,0.01);
+savematfile(TMPDIR + filesep() + "bug_5462.mat", "A");
+A1 = A;
+clear A
+loadmatfile(TMPDIR + filesep() + "bug_5462.mat", "A");
+
+if (norm(A1 - A)>=10*%eps) then pause,end
diff --git a/modules/matio/tests/nonreg_tests/bug_5466.dia.ref b/modules/matio/tests/nonreg_tests/bug_5466.dia.ref
new file mode 100755
index 000000000..ef49f5901
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_5466.dia.ref
@@ -0,0 +1,31 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Vincent COUVERT <vincent.couvert@scilab.org>
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- ENGLISH IMPOSED -->
+// <-- CLI SHELL MODE -->
+// <-- Non-regression test for bug 5466 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=5466
+//
+// <-- Short Description -->
+// I met some problems while saving scilab variables in a Matlab data file.
+// Some times, the variables are not written in the data file.
+A = sprand(400,400,0.01);
+B = sprand(100,100,0.1);
+savematfile(TMPDIR + filesep() + "bug_5466.mat","A","B");
+WARNING: Option -v7 added.
+clear
+loadmatfile(TMPDIR + filesep() + "bug_5466.mat","A","B");
+if or(size(A)<>[400 400]) then bugmes();quit;end
+if or(size(B)<>[100 100]) then bugmes();quit;end
+clear
+A = rand(10,10);
+savematfile(TMPDIR + filesep() + "bug_5466.mat","A");
+WARNING: Option -v7 added.
+clear
+loadmatfile(TMPDIR + filesep() + "bug_5466.mat","A");
+if or(size(A)<>[10 10]) then bugmes();quit;end
diff --git a/modules/matio/tests/nonreg_tests/bug_5466.tst b/modules/matio/tests/nonreg_tests/bug_5466.tst
new file mode 100755
index 000000000..8f7a227a6
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_5466.tst
@@ -0,0 +1,34 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Vincent COUVERT <vincent.couvert@scilab.org>
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- ENGLISH IMPOSED -->
+// <-- CLI SHELL MODE -->
+
+// <-- Non-regression test for bug 5466 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=5466
+//
+// <-- Short Description -->
+// I met some problems while saving scilab variables in a Matlab data file.
+// Some times, the variables are not written in the data file.
+
+A = sprand(400,400,0.01);
+B = sprand(100,100,0.1);
+savematfile(TMPDIR + filesep() + "bug_5466.mat","A","B");
+clear
+loadmatfile(TMPDIR + filesep() + "bug_5466.mat","A","B");
+
+if or(size(A)<>[400 400]) then pause;end
+if or(size(B)<>[100 100]) then pause;end
+
+clear
+A = rand(10,10);
+savematfile(TMPDIR + filesep() + "bug_5466.mat","A");
+clear
+loadmatfile(TMPDIR + filesep() + "bug_5466.mat","A");
+if or(size(A)<>[10 10]) then pause;end
diff --git a/modules/matio/tests/nonreg_tests/bug_7862.dia.ref b/modules/matio/tests/nonreg_tests/bug_7862.dia.ref
new file mode 100755
index 000000000..84a41dc5c
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_7862.dia.ref
@@ -0,0 +1,57 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Vincent COUVERT
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- ENGLISH IMPOSED -->
+//
+// <-- Non-regression test for bug 7862 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=7862
+//
+// <-- Short Description -->
+// "savematfile" only saved the first string in the vector (or matrix) when variable is a vector (or matrix) of strings.
+a0x0 = "";
+savematfile(TMPDIR + filesep() + "a0x0.mat", "a0x0");
+WARNING: Option -v7 added.
+a0x0_saved = a0x0;
+clear a0x0
+loadmatfile(TMPDIR + filesep() + "a0x0.mat");
+if or(a0x0<>a0x0_saved) then bugmes();quit;end
+clear a0x0 a0x0_saved
+a1x1 = "abcde";
+savematfile(TMPDIR + filesep() + "a1x1.mat", "a1x1");
+WARNING: Option -v7 added.
+a1x1_saved = a1x1;
+clear a1x1
+loadmatfile(TMPDIR + filesep() + "a1x1.mat");
+if or(a1x1<>a1x1_saved) then bugmes();quit;end
+clear a1x1 a1x1_saved
+a1x3 = ["aaaa", "bbbb", "cccc"];
+ierr = execstr("savematfile(TMPDIR + filesep() + ""a1x3.mat"", ""a1x3"");", "errcatch");
+WARNING: Option -v7 added.
+msg = lasterror();
+if ierr<>999 | msg<>msprintf(_("%s: Row array of strings saving is not implemented.\n"), "GetCharVariable") then bugmes();quit;end
+a3x1 = ["aaaa"; "bbbb"; "cccc"];
+savematfile(TMPDIR + filesep() + "a3x1.mat", "a3x1");
+WARNING: Option -v7 added.
+a3x1_saved = a3x1;
+clear a3x1
+loadmatfile(TMPDIR + filesep() + "a3x1.mat");
+if or(a3x1<>a3x1_saved) then bugmes();quit;end
+clear a3x1 a3x1_saved
+a3x1 = ["aa"; "bbb"; "cccc"];
+ierr = execstr("savematfile(TMPDIR + filesep() + ""a3x1.mat"", ""a3x1"");", "errcatch");
+WARNING: Option -v7 added.
+msg = lasterror();
+if ierr<>999 | msg<>msprintf(_("%s: Column array of strings with different lengths saving is not implemented.\n"), "GetCharVariable") then bugmes();quit;end
+a2x3 = ["aaaa", "bbbb", "cccc"; "dddd", "eeee", "ffff"];
+ierr = execstr("savematfile(TMPDIR + filesep() + ""a2x3.mat"", ""a2x3"");", "errcatch");
+WARNING: Option -v7 added.
+msg = lasterror();
+if ierr<>999 | msg<>msprintf(_("%s: 2D array of strings saving is not implemented.\n"), "GetCharVariable") then bugmes();quit;end
diff --git a/modules/matio/tests/nonreg_tests/bug_7862.tst b/modules/matio/tests/nonreg_tests/bug_7862.tst
new file mode 100755
index 000000000..ee0b9aef2
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_7862.tst
@@ -0,0 +1,57 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Vincent COUVERT
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- ENGLISH IMPOSED -->
+//
+// <-- Non-regression test for bug 7862 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=7862
+//
+// <-- Short Description -->
+// "savematfile" only saved the first string in the vector (or matrix) when variable is a vector (or matrix) of strings.
+
+a0x0 = "";
+savematfile(TMPDIR + filesep() + "a0x0.mat", "a0x0");
+a0x0_saved = a0x0;
+clear a0x0
+loadmatfile(TMPDIR + filesep() + "a0x0.mat");
+if or(a0x0<>a0x0_saved) then pause; end
+clear a0x0 a0x0_saved
+
+a1x1 = "abcde";
+savematfile(TMPDIR + filesep() + "a1x1.mat", "a1x1");
+a1x1_saved = a1x1;
+clear a1x1
+loadmatfile(TMPDIR + filesep() + "a1x1.mat");
+if or(a1x1<>a1x1_saved) then pause; end
+clear a1x1 a1x1_saved
+
+a1x3 = ["aaaa", "bbbb", "cccc"];
+ierr = execstr("savematfile(TMPDIR + filesep() + ""a1x3.mat"", ""a1x3"");", "errcatch");
+msg = lasterror();
+if ierr<>999 | msg<>msprintf(_("%s: Row array of strings saving is not implemented.\n"), "GetCharVariable") then pause;end
+
+a3x1 = ["aaaa"; "bbbb"; "cccc"];
+savematfile(TMPDIR + filesep() + "a3x1.mat", "a3x1");
+a3x1_saved = a3x1;
+clear a3x1
+loadmatfile(TMPDIR + filesep() + "a3x1.mat");
+if or(a3x1<>a3x1_saved) then pause; end
+clear a3x1 a3x1_saved
+
+a3x1 = ["aa"; "bbb"; "cccc"];
+ierr = execstr("savematfile(TMPDIR + filesep() + ""a3x1.mat"", ""a3x1"");", "errcatch");
+msg = lasterror();
+if ierr<>999 | msg<>msprintf(_("%s: Column array of strings with different lengths saving is not implemented.\n"), "GetCharVariable") then pause;end
+
+a2x3 = ["aaaa", "bbbb", "cccc"; "dddd", "eeee", "ffff"];
+ierr = execstr("savematfile(TMPDIR + filesep() + ""a2x3.mat"", ""a2x3"");", "errcatch");
+msg = lasterror();
+if ierr<>999 | msg<>msprintf(_("%s: 2D array of strings saving is not implemented.\n"), "GetCharVariable") then pause;end
diff --git a/modules/matio/tests/nonreg_tests/bug_8783.dia.ref b/modules/matio/tests/nonreg_tests/bug_8783.dia.ref
new file mode 100755
index 000000000..3dcbb6da1
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_8783.dia.ref
@@ -0,0 +1,143 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2011 - DIGITEO - Vincent COUVERT
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 8783 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=8783
+//
+// <-- Short Description -->
+// loadmatfile could not load hypermatrices of integer types.
+loadmatfile(SCI + "/modules/matio/tests/nonreg_tests/bug_8783.mat")
+int8hmref(:,:,1) = [
+ 127 127 127 127;
+ 127 127 127 127;
+ 127 98 127 127];
+int8hmref(:,:,2) = [
+ 127 127 127 36;
+ 127 127 127 127
+ 127 127 127 127];
+int8hmref(:,:,3) = [
+ 127 127 127 46;
+ 127 127 32 97;
+ 127 127 127 127];
+int8hmref(:,:,4) = [
+ 127 34 127 127;
+ 127 127 127 127;
+ 127 127 127 127];
+int8hmref(:,:,5) = [
+ 127 127 119 127;
+ 127 127 127 127;
+ 127 127 127 127];
+if or(int8hm<>int8hmref) then bugmes();quit;end
+int16hmref(:,:,1) = [
+ 815 913 278 965;
+ 906 632 547 158;
+ 127 98 958 971];
+int16hmref(:,:,2) = [
+ 957 142 792 36;
+ 485 422 959 849;
+ 800 916 656 934];
+int16hmref(:,:,3) = [
+ 679 392 706 46;
+ 758 655 32 97;
+ 743 171 277 823];
+int16hmref(:,:,4) = [
+ 695 34 766 490;
+ 317 439 795 446;
+ 950 382 187 646];
+int16hmref(:,:,5) = [
+ 709 680 119 340;
+ 755 655 498 585;
+ 276 163 960 224];
+if or(int16hm<>int16hmref) then bugmes();quit;end
+int32hmref(:,:,1) = [
+ 815 913 278 965;
+ 906 632 547 158;
+ 127 98 958 971];
+int32hmref(:,:,2) = [
+ 957 142 792 36;
+ 485 422 959 849;
+ 800 916 656 934];
+int32hmref(:,:,3) = [
+ 679 392 706 46;
+ 758 655 32 97;
+ 743 171 277 823];
+int32hmref(:,:,4) = [
+ 695 34 766 490;
+ 317 439 795 446;
+ 950 382 187 646];
+int32hmref(:,:,5) = [
+ 709 680 119 340;
+ 755 655 498 585;
+ 276 163 960 224];
+if or(int32hm<>int32hmref) then bugmes();quit;end
+uint8hmref(:,:,1) = [
+ 255 255 255 255;
+ 255 255 255 158;
+ 127 98 255 255];
+uint8hmref(:,:,2) = [
+ 255 142 255 36;
+ 255 255 255 255;
+ 255 255 255 255];
+uint8hmref(:,:,3) = [
+ 255 255 255 46;
+ 255 255 32 97;
+ 255 171 255 255];
+uint8hmref(:,:,4) = [
+ 255 34 255 255;
+ 255 255 255 255;
+ 255 255 187 255];
+uint8hmref(:,:,5) = [
+ 255 255 119 255;
+ 255 255 255 255;
+ 255 163 255 224];
+if or(uint8hm<>uint8hmref) then bugmes();quit;end
+uint16hmref(:,:,1) = [
+ 815 913 278 965;
+ 906 632 547 158;
+ 127 98 958 971];
+uint16hmref(:,:,2) = [
+ 957 142 792 36;
+ 485 422 959 849;
+ 800 916 656 934];
+uint16hmref(:,:,3) = [
+ 679 392 706 46;
+ 758 655 32 97;
+ 743 171 277 823];
+uint16hmref(:,:,4) = [
+ 695 34 766 490;
+ 317 439 795 446;
+ 950 382 187 646];
+uint16hmref(:,:,5) = [
+ 709 680 119 340;
+ 755 655 498 585;
+ 276 163 960 224];
+if or(uint16hm<>uint16hmref) then bugmes();quit;end
+uint32hmref(:,:,1) = [
+ 815 913 278 965;
+ 906 632 547 158;
+ 127 98 958 971];
+uint32hmref(:,:,2) = [
+ 957 142 792 36;
+ 485 422 959 849;
+ 800 916 656 934];
+uint32hmref(:,:,3) = [
+ 679 392 706 46;
+ 758 655 32 97;
+ 743 171 277 823];
+uint32hmref(:,:,4) = [
+ 695 34 766 490;
+ 317 439 795 446;
+ 950 382 187 646];
+uint32hmref(:,:,5) = [
+ 709 680 119 340;
+ 755 655 498 585;
+ 276 163 960 224];
+if or(uint32hm<>uint32hmref) then bugmes();quit;end
diff --git a/modules/matio/tests/nonreg_tests/bug_8783.mat b/modules/matio/tests/nonreg_tests/bug_8783.mat
new file mode 100755
index 000000000..42ab6350a
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_8783.mat
Binary files differ
diff --git a/modules/matio/tests/nonreg_tests/bug_8783.tst b/modules/matio/tests/nonreg_tests/bug_8783.tst
new file mode 100755
index 000000000..604e4246b
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_8783.tst
@@ -0,0 +1,156 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2011 - DIGITEO - Vincent COUVERT
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 8783 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=8783
+//
+// <-- Short Description -->
+// loadmatfile could not load hypermatrices of integer types.
+
+loadmatfile(SCI + "/modules/matio/tests/nonreg_tests/bug_8783.mat")
+
+int8hmref(:,:,1) = [
+ 127 127 127 127;
+ 127 127 127 127;
+ 127 98 127 127];
+int8hmref(:,:,2) = [
+ 127 127 127 36;
+ 127 127 127 127
+ 127 127 127 127];
+int8hmref(:,:,3) = [
+ 127 127 127 46;
+ 127 127 32 97;
+ 127 127 127 127];
+int8hmref(:,:,4) = [
+ 127 34 127 127;
+ 127 127 127 127;
+ 127 127 127 127];
+int8hmref(:,:,5) = [
+ 127 127 119 127;
+ 127 127 127 127;
+ 127 127 127 127];
+
+if or(int8hm<>int8hmref) then pause; end
+
+int16hmref(:,:,1) = [
+ 815 913 278 965;
+ 906 632 547 158;
+ 127 98 958 971];
+int16hmref(:,:,2) = [
+ 957 142 792 36;
+ 485 422 959 849;
+ 800 916 656 934];
+int16hmref(:,:,3) = [
+ 679 392 706 46;
+ 758 655 32 97;
+ 743 171 277 823];
+int16hmref(:,:,4) = [
+ 695 34 766 490;
+ 317 439 795 446;
+ 950 382 187 646];
+int16hmref(:,:,5) = [
+ 709 680 119 340;
+ 755 655 498 585;
+ 276 163 960 224];
+
+if or(int16hm<>int16hmref) then pause; end
+
+int32hmref(:,:,1) = [
+ 815 913 278 965;
+ 906 632 547 158;
+ 127 98 958 971];
+int32hmref(:,:,2) = [
+ 957 142 792 36;
+ 485 422 959 849;
+ 800 916 656 934];
+int32hmref(:,:,3) = [
+ 679 392 706 46;
+ 758 655 32 97;
+ 743 171 277 823];
+int32hmref(:,:,4) = [
+ 695 34 766 490;
+ 317 439 795 446;
+ 950 382 187 646];
+int32hmref(:,:,5) = [
+ 709 680 119 340;
+ 755 655 498 585;
+ 276 163 960 224];
+
+if or(int32hm<>int32hmref) then pause; end
+
+uint8hmref(:,:,1) = [
+ 255 255 255 255;
+ 255 255 255 158;
+ 127 98 255 255];
+uint8hmref(:,:,2) = [
+ 255 142 255 36;
+ 255 255 255 255;
+ 255 255 255 255];
+uint8hmref(:,:,3) = [
+ 255 255 255 46;
+ 255 255 32 97;
+ 255 171 255 255];
+uint8hmref(:,:,4) = [
+ 255 34 255 255;
+ 255 255 255 255;
+ 255 255 187 255];
+uint8hmref(:,:,5) = [
+ 255 255 119 255;
+ 255 255 255 255;
+ 255 163 255 224];
+
+if or(uint8hm<>uint8hmref) then pause; end
+
+uint16hmref(:,:,1) = [
+ 815 913 278 965;
+ 906 632 547 158;
+ 127 98 958 971];
+uint16hmref(:,:,2) = [
+ 957 142 792 36;
+ 485 422 959 849;
+ 800 916 656 934];
+uint16hmref(:,:,3) = [
+ 679 392 706 46;
+ 758 655 32 97;
+ 743 171 277 823];
+uint16hmref(:,:,4) = [
+ 695 34 766 490;
+ 317 439 795 446;
+ 950 382 187 646];
+uint16hmref(:,:,5) = [
+ 709 680 119 340;
+ 755 655 498 585;
+ 276 163 960 224];
+
+if or(uint16hm<>uint16hmref) then pause; end
+
+uint32hmref(:,:,1) = [
+ 815 913 278 965;
+ 906 632 547 158;
+ 127 98 958 971];
+uint32hmref(:,:,2) = [
+ 957 142 792 36;
+ 485 422 959 849;
+ 800 916 656 934];
+uint32hmref(:,:,3) = [
+ 679 392 706 46;
+ 758 655 32 97;
+ 743 171 277 823];
+uint32hmref(:,:,4) = [
+ 695 34 766 490;
+ 317 439 795 446;
+ 950 382 187 646];
+uint32hmref(:,:,5) = [
+ 709 680 119 340;
+ 755 655 498 585;
+ 276 163 960 224];
+
+if or(uint32hm<>uint32hmref) then pause; end
diff --git a/modules/matio/tests/nonreg_tests/bug_8828.dia.ref b/modules/matio/tests/nonreg_tests/bug_8828.dia.ref
new file mode 100755
index 000000000..9f3a7f260
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_8828.dia.ref
@@ -0,0 +1,19 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2011 - DIGITEO - Vincent COUVERT
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 8828 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=8828
+//
+// <-- Short Description -->
+// "savematfile" could no more save a structure.
+Astruct.str = "example";
+Astruct.num = 123456789;
+savematfile(TMPDIR + filesep() + "bug_8828.mat", "Astruct", "-v6");
diff --git a/modules/matio/tests/nonreg_tests/bug_8828.tst b/modules/matio/tests/nonreg_tests/bug_8828.tst
new file mode 100755
index 000000000..7d21a07cc
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_8828.tst
@@ -0,0 +1,20 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2011 - DIGITEO - Vincent COUVERT
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 8828 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=8828
+//
+// <-- Short Description -->
+// "savematfile" could no more save a structure.
+
+Astruct.str = "example";
+Astruct.num = 123456789;
+savematfile(TMPDIR + filesep() + "bug_8828.mat", "Astruct", "-v6");
diff --git a/modules/matio/tests/nonreg_tests/bug_9354.dia.ref b/modules/matio/tests/nonreg_tests/bug_9354.dia.ref
new file mode 100755
index 000000000..09558695f
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_9354.dia.ref
@@ -0,0 +1,27 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2011 - DIGITEO - Vincent COUVERT
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 9354 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=9354
+//
+// <-- Short Description -->
+// "savematfile" could not save imbricated structures.
+// Try to save the structure
+V.a.a = 1;
+V.a.b = 2;
+V.b.a = 3;
+savematfile(TMPDIR + filesep() + "bug_9354.mat", "V", "-v7")
+// Try to reload the structure
+refV = V;
+clear V
+loadmatfile(TMPDIR + filesep() + "bug_9354.mat");
+// Compare saved and read variables
+assert_checkequal(V, refV);
diff --git a/modules/matio/tests/nonreg_tests/bug_9354.tst b/modules/matio/tests/nonreg_tests/bug_9354.tst
new file mode 100755
index 000000000..768bb7439
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/bug_9354.tst
@@ -0,0 +1,30 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2011 - DIGITEO - Vincent COUVERT
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 9354 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=9354
+//
+// <-- Short Description -->
+// "savematfile" could not save imbricated structures.
+
+// Try to save the structure
+V.a.a = 1;
+V.a.b = 2;
+V.b.a = 3;
+savematfile(TMPDIR + filesep() + "bug_9354.mat", "V", "-v7")
+
+// Try to reload the structure
+refV = V;
+clear V
+loadmatfile(TMPDIR + filesep() + "bug_9354.mat");
+
+// Compare saved and read variables
+assert_checkequal(V, refV);
diff --git a/modules/matio/tests/nonreg_tests/t-circle.mat b/modules/matio/tests/nonreg_tests/t-circle.mat
new file mode 100755
index 000000000..dc650cfde
--- /dev/null
+++ b/modules/matio/tests/nonreg_tests/t-circle.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/arraycell-v6.mat b/modules/matio/tests/unit_tests/arraycell-v6.mat
new file mode 100755
index 000000000..8821a5024
--- /dev/null
+++ b/modules/matio/tests/unit_tests/arraycell-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/arraycell-v7.mat b/modules/matio/tests/unit_tests/arraycell-v7.mat
new file mode 100755
index 000000000..6b77cf61d
--- /dev/null
+++ b/modules/matio/tests/unit_tests/arraycell-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/arraystruct-v6.mat b/modules/matio/tests/unit_tests/arraystruct-v6.mat
new file mode 100755
index 000000000..79fa3865b
--- /dev/null
+++ b/modules/matio/tests/unit_tests/arraystruct-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/arraystruct-v7.mat b/modules/matio/tests/unit_tests/arraystruct-v7.mat
new file mode 100755
index 000000000..bc73f63c2
--- /dev/null
+++ b/modules/matio/tests/unit_tests/arraystruct-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/colcell-v6.mat b/modules/matio/tests/unit_tests/colcell-v6.mat
new file mode 100755
index 000000000..71a9bbe24
--- /dev/null
+++ b/modules/matio/tests/unit_tests/colcell-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/colcell-v7.mat b/modules/matio/tests/unit_tests/colcell-v7.mat
new file mode 100755
index 000000000..fcd8750dc
--- /dev/null
+++ b/modules/matio/tests/unit_tests/colcell-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/colstruct-v6.mat b/modules/matio/tests/unit_tests/colstruct-v6.mat
new file mode 100755
index 000000000..ed6479b5a
--- /dev/null
+++ b/modules/matio/tests/unit_tests/colstruct-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/colstruct-v7.mat b/modules/matio/tests/unit_tests/colstruct-v7.mat
new file mode 100755
index 000000000..040157261
--- /dev/null
+++ b/modules/matio/tests/unit_tests/colstruct-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/complexdoubleNDarray-v6.mat b/modules/matio/tests/unit_tests/complexdoubleNDarray-v6.mat
new file mode 100755
index 000000000..94e7e1bc1
--- /dev/null
+++ b/modules/matio/tests/unit_tests/complexdoubleNDarray-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/complexdoubleNDarray-v7.mat b/modules/matio/tests/unit_tests/complexdoubleNDarray-v7.mat
new file mode 100755
index 000000000..686ab4170
--- /dev/null
+++ b/modules/matio/tests/unit_tests/complexdoubleNDarray-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/cplxdoublecolvector-v4.mat b/modules/matio/tests/unit_tests/cplxdoublecolvector-v4.mat
new file mode 100755
index 000000000..b76c7146d
--- /dev/null
+++ b/modules/matio/tests/unit_tests/cplxdoublecolvector-v4.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/cplxdoublecolvector-v6.mat b/modules/matio/tests/unit_tests/cplxdoublecolvector-v6.mat
new file mode 100755
index 000000000..69a792e81
--- /dev/null
+++ b/modules/matio/tests/unit_tests/cplxdoublecolvector-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/cplxdoublecolvector-v7.mat b/modules/matio/tests/unit_tests/cplxdoublecolvector-v7.mat
new file mode 100755
index 000000000..5143d7274
--- /dev/null
+++ b/modules/matio/tests/unit_tests/cplxdoublecolvector-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/cplxdoublematrix-v4.mat b/modules/matio/tests/unit_tests/cplxdoublematrix-v4.mat
new file mode 100755
index 000000000..36fdbdb79
--- /dev/null
+++ b/modules/matio/tests/unit_tests/cplxdoublematrix-v4.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/cplxdoublematrix-v6.mat b/modules/matio/tests/unit_tests/cplxdoublematrix-v6.mat
new file mode 100755
index 000000000..9319d1b94
--- /dev/null
+++ b/modules/matio/tests/unit_tests/cplxdoublematrix-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/cplxdoublematrix-v7.mat b/modules/matio/tests/unit_tests/cplxdoublematrix-v7.mat
new file mode 100755
index 000000000..213dc391d
--- /dev/null
+++ b/modules/matio/tests/unit_tests/cplxdoublematrix-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/cplxdoublerowvector-v4.mat b/modules/matio/tests/unit_tests/cplxdoublerowvector-v4.mat
new file mode 100755
index 000000000..94af8b442
--- /dev/null
+++ b/modules/matio/tests/unit_tests/cplxdoublerowvector-v4.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/cplxdoublerowvector-v6.mat b/modules/matio/tests/unit_tests/cplxdoublerowvector-v6.mat
new file mode 100755
index 000000000..7ce880645
--- /dev/null
+++ b/modules/matio/tests/unit_tests/cplxdoublerowvector-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/cplxdoublerowvector-v7.mat b/modules/matio/tests/unit_tests/cplxdoublerowvector-v7.mat
new file mode 100755
index 000000000..7638870bd
--- /dev/null
+++ b/modules/matio/tests/unit_tests/cplxdoublerowvector-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/cplxdoublescalar-v4.mat b/modules/matio/tests/unit_tests/cplxdoublescalar-v4.mat
new file mode 100755
index 000000000..fc71949fc
--- /dev/null
+++ b/modules/matio/tests/unit_tests/cplxdoublescalar-v4.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/cplxdoublescalar-v6.mat b/modules/matio/tests/unit_tests/cplxdoublescalar-v6.mat
new file mode 100755
index 000000000..4b9003fab
--- /dev/null
+++ b/modules/matio/tests/unit_tests/cplxdoublescalar-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/cplxdoublescalar-v7.mat b/modules/matio/tests/unit_tests/cplxdoublescalar-v7.mat
new file mode 100755
index 000000000..1d7501465
--- /dev/null
+++ b/modules/matio/tests/unit_tests/cplxdoublescalar-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptyNDarray-v6.mat b/modules/matio/tests/unit_tests/emptyNDarray-v6.mat
new file mode 100755
index 000000000..081f5ed64
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptyNDarray-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptyNDarray-v7.mat b/modules/matio/tests/unit_tests/emptyNDarray-v7.mat
new file mode 100755
index 000000000..5f63a28db
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptyNDarray-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptycell-v6.mat b/modules/matio/tests/unit_tests/emptycell-v6.mat
new file mode 100755
index 000000000..1aea52320
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptycell-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptycell-v7.mat b/modules/matio/tests/unit_tests/emptycell-v7.mat
new file mode 100755
index 000000000..84cb2ea76
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptycell-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptydoublematrix-v4.mat b/modules/matio/tests/unit_tests/emptydoublematrix-v4.mat
new file mode 100755
index 000000000..bbd4b1e34
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptydoublematrix-v4.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptydoublematrix-v6.mat b/modules/matio/tests/unit_tests/emptydoublematrix-v6.mat
new file mode 100755
index 000000000..5f317d8de
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptydoublematrix-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptydoublematrix-v7.mat b/modules/matio/tests/unit_tests/emptydoublematrix-v7.mat
new file mode 100755
index 000000000..c284cd0ce
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptydoublematrix-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptyint16matrix-v6.mat b/modules/matio/tests/unit_tests/emptyint16matrix-v6.mat
new file mode 100755
index 000000000..1d2883269
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptyint16matrix-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptyint16matrix-v7.mat b/modules/matio/tests/unit_tests/emptyint16matrix-v7.mat
new file mode 100755
index 000000000..ca7d78cb3
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptyint16matrix-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptyint32matrix-v6.mat b/modules/matio/tests/unit_tests/emptyint32matrix-v6.mat
new file mode 100755
index 000000000..7bd2e27fa
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptyint32matrix-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptyint32matrix-v7.mat b/modules/matio/tests/unit_tests/emptyint32matrix-v7.mat
new file mode 100755
index 000000000..08e61c907
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptyint32matrix-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptyint8matrix-v6.mat b/modules/matio/tests/unit_tests/emptyint8matrix-v6.mat
new file mode 100755
index 000000000..c3f6c3516
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptyint8matrix-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptyint8matrix-v7.mat b/modules/matio/tests/unit_tests/emptyint8matrix-v7.mat
new file mode 100755
index 000000000..a2efbebcb
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptyint8matrix-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptysparse-v6.mat b/modules/matio/tests/unit_tests/emptysparse-v6.mat
new file mode 100755
index 000000000..d6ca4a5f0
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptysparse-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptysparse-v7.mat b/modules/matio/tests/unit_tests/emptysparse-v7.mat
new file mode 100755
index 000000000..0e8bfbccc
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptysparse-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptystringmatrix-v4.mat b/modules/matio/tests/unit_tests/emptystringmatrix-v4.mat
new file mode 100755
index 000000000..5e2e5561b
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptystringmatrix-v4.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptystringmatrix-v6.mat b/modules/matio/tests/unit_tests/emptystringmatrix-v6.mat
new file mode 100755
index 000000000..44e55636b
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptystringmatrix-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptystringmatrix-v7.mat b/modules/matio/tests/unit_tests/emptystringmatrix-v7.mat
new file mode 100755
index 000000000..921a371d0
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptystringmatrix-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptystruct-v6.mat b/modules/matio/tests/unit_tests/emptystruct-v6.mat
new file mode 100755
index 000000000..a217cc71b
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptystruct-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptystruct-v7.mat b/modules/matio/tests/unit_tests/emptystruct-v7.mat
new file mode 100755
index 000000000..3fa8dbabb
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptystruct-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptyuint16matrix-v6.mat b/modules/matio/tests/unit_tests/emptyuint16matrix-v6.mat
new file mode 100755
index 000000000..10d265a2c
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptyuint16matrix-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptyuint16matrix-v7.mat b/modules/matio/tests/unit_tests/emptyuint16matrix-v7.mat
new file mode 100755
index 000000000..16a7fae8d
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptyuint16matrix-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptyuint32matrix-v6.mat b/modules/matio/tests/unit_tests/emptyuint32matrix-v6.mat
new file mode 100755
index 000000000..1f0d08e83
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptyuint32matrix-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptyuint32matrix-v7.mat b/modules/matio/tests/unit_tests/emptyuint32matrix-v7.mat
new file mode 100755
index 000000000..34861856d
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptyuint32matrix-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptyuint8matrix-v6.mat b/modules/matio/tests/unit_tests/emptyuint8matrix-v6.mat
new file mode 100755
index 000000000..85d75f628
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptyuint8matrix-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/emptyuint8matrix-v7.mat b/modules/matio/tests/unit_tests/emptyuint8matrix-v7.mat
new file mode 100755
index 000000000..43e67bd1c
--- /dev/null
+++ b/modules/matio/tests/unit_tests/emptyuint8matrix-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/eye100x100-v4.mat b/modules/matio/tests/unit_tests/eye100x100-v4.mat
new file mode 100755
index 000000000..1a329f193
--- /dev/null
+++ b/modules/matio/tests/unit_tests/eye100x100-v4.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/eye100x100-v6.mat b/modules/matio/tests/unit_tests/eye100x100-v6.mat
new file mode 100755
index 000000000..69d4082fd
--- /dev/null
+++ b/modules/matio/tests/unit_tests/eye100x100-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/eye100x100-v7.mat b/modules/matio/tests/unit_tests/eye100x100-v7.mat
new file mode 100755
index 000000000..3215db1fe
--- /dev/null
+++ b/modules/matio/tests/unit_tests/eye100x100-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int16colvector-v6.mat b/modules/matio/tests/unit_tests/int16colvector-v6.mat
new file mode 100755
index 000000000..922813592
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int16colvector-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int16colvector-v7.mat b/modules/matio/tests/unit_tests/int16colvector-v7.mat
new file mode 100755
index 000000000..ad39f9958
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int16colvector-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int16matrix-v6.mat b/modules/matio/tests/unit_tests/int16matrix-v6.mat
new file mode 100755
index 000000000..165561c03
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int16matrix-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int16matrix-v7.mat b/modules/matio/tests/unit_tests/int16matrix-v7.mat
new file mode 100755
index 000000000..fa754aa38
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int16matrix-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int16rowvector-v6.mat b/modules/matio/tests/unit_tests/int16rowvector-v6.mat
new file mode 100755
index 000000000..8fba06bc8
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int16rowvector-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int16rowvector-v7.mat b/modules/matio/tests/unit_tests/int16rowvector-v7.mat
new file mode 100755
index 000000000..19956b07e
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int16rowvector-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int16scalar-v6.mat b/modules/matio/tests/unit_tests/int16scalar-v6.mat
new file mode 100755
index 000000000..463a68340
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int16scalar-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int16scalar-v7.mat b/modules/matio/tests/unit_tests/int16scalar-v7.mat
new file mode 100755
index 000000000..67ff81346
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int16scalar-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int32colvector-v6.mat b/modules/matio/tests/unit_tests/int32colvector-v6.mat
new file mode 100755
index 000000000..f8e672480
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int32colvector-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int32colvector-v7.mat b/modules/matio/tests/unit_tests/int32colvector-v7.mat
new file mode 100755
index 000000000..a9419b7f7
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int32colvector-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int32matrix-v6.mat b/modules/matio/tests/unit_tests/int32matrix-v6.mat
new file mode 100755
index 000000000..a76e2767c
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int32matrix-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int32matrix-v7.mat b/modules/matio/tests/unit_tests/int32matrix-v7.mat
new file mode 100755
index 000000000..fe0a932e2
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int32matrix-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int32rowvector-v6.mat b/modules/matio/tests/unit_tests/int32rowvector-v6.mat
new file mode 100755
index 000000000..deb1f3acc
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int32rowvector-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int32rowvector-v7.mat b/modules/matio/tests/unit_tests/int32rowvector-v7.mat
new file mode 100755
index 000000000..d07d8b045
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int32rowvector-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int32scalar-v6.mat b/modules/matio/tests/unit_tests/int32scalar-v6.mat
new file mode 100755
index 000000000..ed58aaa59
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int32scalar-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int32scalar-v7.mat b/modules/matio/tests/unit_tests/int32scalar-v7.mat
new file mode 100755
index 000000000..6c43a6acd
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int32scalar-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int8colvector-v6.mat b/modules/matio/tests/unit_tests/int8colvector-v6.mat
new file mode 100755
index 000000000..27bfa9fc9
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int8colvector-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int8colvector-v7.mat b/modules/matio/tests/unit_tests/int8colvector-v7.mat
new file mode 100755
index 000000000..54a7ab88f
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int8colvector-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int8matrix-v6.mat b/modules/matio/tests/unit_tests/int8matrix-v6.mat
new file mode 100755
index 000000000..d6b47ea2f
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int8matrix-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int8matrix-v7.mat b/modules/matio/tests/unit_tests/int8matrix-v7.mat
new file mode 100755
index 000000000..4094c5d6c
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int8matrix-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int8rowvector-v6.mat b/modules/matio/tests/unit_tests/int8rowvector-v6.mat
new file mode 100755
index 000000000..0906b4608
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int8rowvector-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int8rowvector-v7.mat b/modules/matio/tests/unit_tests/int8rowvector-v7.mat
new file mode 100755
index 000000000..faf8a8a00
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int8rowvector-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int8scalar-v6.mat b/modules/matio/tests/unit_tests/int8scalar-v6.mat
new file mode 100755
index 000000000..c430ec8f0
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int8scalar-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/int8scalar-v7.mat b/modules/matio/tests/unit_tests/int8scalar-v7.mat
new file mode 100755
index 000000000..b78104b84
--- /dev/null
+++ b/modules/matio/tests/unit_tests/int8scalar-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/loadmatfile.dia.ref b/modules/matio/tests/unit_tests/loadmatfile.dia.ref
new file mode 100755
index 000000000..10c853cb3
--- /dev/null
+++ b/modules/matio/tests/unit_tests/loadmatfile.dia.ref
@@ -0,0 +1,475 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Vincent Couvert <vincent.couvert@inria.fr>
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// This Scilab script loads MAT-files to test the MATIO module
+clear all
+//
+// Loads all MAT-files
+//
+binFormats = ["-v4";"-v6";"-v7"];
+for formatIndex = 1:size(binFormats, "*")
+ matFiles = gsort(listfiles("SCI/modules/matio/tests/unit_tests/*" + binFormats(formatIndex) + ".mat"), "r", "i");
+ for fileIndex=1:size(matFiles, "*")
+ disp(fileparts(matFiles(fileIndex), "fname") + fileparts(matFiles(fileIndex), "extension"));
+ loadmatfile(matFiles(fileIndex));
+ end
+ //
+ // TESTS FOR CELL ARRAYS
+ //
+ if binFormats(formatIndex) <> "-v4" then // Cell arrays can not be stored in Matlab 4 binary files
+ assert_checkequal(emptycell , cell());
+ assert_checkequal(scalarcell , makecell([1 1], 1.23));
+ assert_checkequal(rowcell , makecell([1 3], "abc", [1.23+7.89*%i 4.56-1.23*%i 7.89+4.56*%i], 1.23));
+ assert_checkequal(colcell , makecell([3 1], [1.23+7.89*%i 4.56-1.23*%i 7.89+4.56*%i], "abc", 1.23));
+ assert_checkequal(arraycell , makecell([2 3], "a", [1.23+7.89*%i 4.56-1.23*%i 7.89+4.56*%i], int8(1), "abc", 1.23, eye(100,100)));
+ assert_checkequal(stringcell , makecell([2 3], "abc", "def", "ghi", "jkl", "mno", "pqr"));
+ clear emptycell scalarcell rowcell colcell arraycell stringcell
+ end
+ //
+ // TESTS FOR STRUCTURE ARRAYS
+ //
+ if binFormats(formatIndex) <> "-v4" then // Struct arrays can not be stored in Matlab 4 binary files
+ sciemptystruct = struct();
+ assert_checkequal(emptystruct , sciemptystruct);
+ sciscalarstruct = struct("f1", 10, "ftwo", "Hello", "field3", int8(12));
+ assert_checkequal(scalarstruct , sciscalarstruct);
+ scirowstruct = struct("field1", 10, "field2", "Hello", "field3", int8(12));
+ scirowstruct(1,2).field1 = "test";
+ scirowstruct(1,2).field2 = eye(10, 10);
+ scirowstruct(1,3).field2 = "a field contents";
+ scirowstruct(1,3).field3 = 1.23+4.56*%i;
+ assert_checkequal(rowstruct , scirowstruct);
+ scicolstruct = struct("name", 10, "phone", "Hello", "address", int8(12));
+ scicolstruct(2,1).name = "test";
+ scicolstruct(2,1).phone = eye(10, 10);
+ scicolstruct(3,1).phone = "a field contents";
+ scicolstruct(3,1).address = 1.23+4.56*%i;
+ assert_checkequal(colstruct , scicolstruct);
+ sciarraystruct = struct("field1", 10, "field2", "Hello", "field3", int8(12));
+ sciarraystruct(1,2).field1 = "test";
+ sciarraystruct(1,2).field2 = eye(10, 10);
+ sciarraystruct(1,3).field2 = "a field contents";
+ sciarraystruct(1,3).field3 = 1.23+4.56*%i;
+ sciarraystruct(2,1).name = "test";
+ sciarraystruct(2,1).phone = eye(10, 10);
+ sciarraystruct(3,1).phone = "a field contents";
+ sciarraystruct(3,1).address = 1.23+4.56*%i;
+ assert_checkequal(arraystruct , sciarraystruct);
+ clear emptystruct scalarstruct rowstruct colstruct arraystruct
+ clear sciemptystruct sciscalarstruct scirowstruct scicolstruct sciarraystruct
+ end
+ //
+ // TESTS FOR OBJECTS
+ //
+ // TODO
+ //
+ // TESTS FOR CHARACTER ARRAYS
+ //
+ assert_checkequal(emptystringmatrix , "");
+ assert_checkequal(stringscalar , "a");
+ assert_checkequal(stringrowvector , ["abc"]);
+ assert_checkequal(stringcolvector , ["a";"b";"c"]);
+ assert_checkequal(stringmatrix , ["abc";"def"]);
+ clear emptystringmatrix stringscalar stringrowvector stringcolvector stringmatrix
+ //
+ // TESTS FOR DOUBLE PRECISION ARRAYS
+ //
+ assert_checkequal(emptydoublematrix , []);
+ assert_checkequal(realdoublescalar , 1.23);
+ assert_checkequal(cplxdoublescalar , 1.23 + 4.56*%i);
+ assert_checkequal(realdoublerowvector , [1.23 -4.56 7.89]);
+ assert_checkequal(cplxdoublerowvector , [1.23+7.89*%i 4.56-1.23*%i 7.89+4.56*%i]);
+ assert_checkequal(realdoublecolvector , [1.23;-4.56;7.89]);
+ assert_checkequal(cplxdoublecolvector , [1.23+7.89*%i;4.56-1.23*%i;7.89+4.56*%i]);
+ assert_checkequal(realdoublematrix , [1.23 -4.56 7.89;9.87 6.54 -3.21]);
+ assert_checkequal(cplxdoublematrix , [1.23+7.89*%i 4.56-1.23*%i 7.89+4.56*%i;9.87+3.21*%i 6.54+9.87*%i 3.21-6.54*%i]);
+ clear emptydoublematrix realdoublescalar cplxdoublescalar realdoublerowvector cplxdoublerowvector realdoublecolvector cplxdoublecolvector realdoublematrix cplxdoublematrix
+ //
+ // TESTS FOR SINGLE PRECISION ARRAYS
+ //
+ // TODO
+ //
+ // TESTS FOR SPARSE MATRICES
+ //
+ if binFormats(formatIndex) <> "-v4" then // Integers can not be stored in Matlab 4 binary files
+ assert_checkequal(emptysparse , []);
+ assert_checkequal(realscalarsparse , sparse(1.23));
+ //assert_checkequal(cplxscalarsparse , sparse(1.23 + 4.56i));
+ assert_checkequal(realrowvectorsparse , sparse([1.23 0 7.89]));
+ //assert_checkequal(cplxrowvectorsparse , sparse([1.23+7.89i 0 7.89+4.56i]));
+ assert_checkequal(realcolvectorsparse , sparse([1.23;0;7.89]));
+ //assert_checkequal(cplxcolvectorsparse , sparse([1.23+7.89i;;7.89+4.56i]));
+ assert_checkequal(realmatrixsparse , sparse([1.23 0 7.89;0 6.54 -3.21]));
+ //assert_checkequal(cplxmatrixsparse , sparse([1.23+7.89i 0 7.89+4.56i;0 6.54+9.87i 3.21-6.54i]));
+end
+ if binFormats(formatIndex) <> "-v4" then // Integers can not be stored in Matlab 4 binary files
+ //
+ // TESTS FOR 8-BITS SIGNED INTEGERS
+ //
+ assert_checkequal(emptyint8matrix , int8([]));
+ assert_checkequal(int8scalar , int8(1));
+ assert_checkequal(int8rowvector , int8([1 -4 7]));
+ assert_checkequal(int8colvector , int8([1;-4;7]));
+ assert_checkequal(int8matrix , int8([1 -4 7;-9 6 -3]));
+ clear emptyint8matrix int8scalar int8rowvector int8colvector int8matrix
+ //
+ // TESTS FOR 16-BITS SIGNED INTEGERS
+ //
+ assert_checkequal(emptyint16matrix , int16([]));
+ assert_checkequal(int16scalar , int16(1));
+ assert_checkequal(int16rowvector , int16([1 -4 7]));
+ assert_checkequal(int16colvector , int16([1;-4;7]));
+ assert_checkequal(int16matrix , int16([1 -4 7;-9 6 -3]));
+ clear emptyint16matrix int16scalar int16rowvector int16colvector int16matrix
+ //
+ // TESTS FOR 32-BITS SIGNED INTEGERS
+ //
+ assert_checkequal(emptyint32matrix , int32([]));
+ assert_checkequal(int32scalar , int32(1));
+ assert_checkequal(int32rowvector , int32([1 -4 7]));
+ assert_checkequal(int32colvector , int32([1;-4;7]));
+ assert_checkequal(int32matrix , int32([1 -4 7;-9 6 -3]));
+ clear emptyint32matrix int32scalar int32rowvector int32colvector int32matrix
+ // TODO: int64 tests ?
+ //
+ // TESTS FOR 8-BITS UNSIGNED INTEGERS
+ //
+ assert_checkequal(emptyuint8matrix , uint8([]));
+ assert_checkequal(uint8scalar , uint8(1));
+ //assert_checkequal(uint8rowvector , uint8([1 -4 7]));
+ assert_checkequal(uint8rowvector , uint8([1 0 7]));
+ //assert_checkequal(uint8colvector , uint8([1;-4;7]));
+ assert_checkequal(uint8colvector , uint8([1;0;7]));
+ //assert_checkequal(uint8matrix , uint8([1 -4 7;-9 6 -3]));
+ assert_checkequal(uint8matrix , uint8([1 0 7;0 6 0]));
+ clear emptyuint8matrix uint8scalar uint8rowvector uint8colvector uint8matrix
+ //
+ // TESTS FOR 16-BITS UNSIGNED INTEGERS
+ //
+ assert_checkequal(emptyuint16matrix , uint16([]));
+ assert_checkequal(uint16scalar , uint16(1));
+ //assert_checkequal(uint16rowvector , uint16([1 -4 7]));
+ assert_checkequal(uint16rowvector , uint16([1 0 7]));
+ //assert_checkequal(uint16colvector , uint16([1;-4;7]));
+ assert_checkequal(uint16colvector , uint16([1;0;7]));
+ //assert_checkequal(uint16matrix , uint16([1 -4 7;-9 6 -3]));
+ assert_checkequal(uint16matrix , uint16([1 0 7;0 6 0]));
+ clear emptyuint16matrix uint16scalar uint16rowvector uint16colvector uint16matrix
+ //
+ // TESTS FOR 32-BITS UNSIGNED INTEGERS
+ //
+ assert_checkequal(emptyuint32matrix , uint32([]));
+ assert_checkequal(uint32scalar , uint32(1));
+ //assert_checkequal(uint32rowvector , uint32([1 -4 7]));
+ assert_checkequal(uint32rowvector , uint32([1 0 7]));
+ //assert_checkequal(uint32colvector , uint32([1;-4;7]));
+ assert_checkequal(uint32colvector , uint32([1;0;7]));
+ //assert_checkequal(uint32matrix , uint32([1 -4 7;-9 6 -3]));
+ assert_checkequal(uint32matrix , uint32([1 0 7;0 6 0]));
+ clear emptyuint32matrix uint32scalar uint32rowvector uint32colvector uint32matrix
+ // TODO: uint64 tests ?
+ //
+ // TESTS FOR ND-ARRAYS
+ //
+ assert_checkequal(emptyNDarray.dims , int32([0 0 0]));
+ assert_checkequal(emptyNDarray.entries , []);
+ assert_checkequal(realdoubleNDarray , matrix(1:24, 2, 3, 4));
+ assert_checkequal(complexdoubleNDarray , matrix((1:24) + (1:24)*%i, 2, 3, 4));
+ clear emptyNDarray realdoubleNDarray complexdoubleNDarray
+ end
+ //
+ // MISC
+ //
+ assert_checkequal(eye100x100 , eye(100,100));
+end
+
+ cplxdoublecolvector-v4.mat
+
+ cplxdoublematrix-v4.mat
+
+ cplxdoublerowvector-v4.mat
+
+ cplxdoublescalar-v4.mat
+
+ emptydoublematrix-v4.mat
+
+ emptystringmatrix-v4.mat
+
+ eye100x100-v4.mat
+
+ realdoublecolvector-v4.mat
+
+ realdoublematrix-v4.mat
+
+ realdoublerowvector-v4.mat
+
+ realdoublescalar-v4.mat
+
+ stringcolvector-v4.mat
+
+ stringmatrix-v4.mat
+
+ stringrowvector-v4.mat
+
+ stringscalar-v4.mat
+
+ arraycell-v6.mat
+
+ arraystruct-v6.mat
+
+ colcell-v6.mat
+
+ colstruct-v6.mat
+
+ complexdoubleNDarray-v6.mat
+
+ cplxdoublecolvector-v6.mat
+
+ cplxdoublematrix-v6.mat
+
+ cplxdoublerowvector-v6.mat
+
+ cplxdoublescalar-v6.mat
+
+ emptyNDarray-v6.mat
+
+ emptycell-v6.mat
+
+ emptydoublematrix-v6.mat
+
+ emptyint16matrix-v6.mat
+
+ emptyint32matrix-v6.mat
+
+ emptyint8matrix-v6.mat
+
+ emptysparse-v6.mat
+
+ emptystringmatrix-v6.mat
+
+ emptystruct-v6.mat
+
+ emptyuint16matrix-v6.mat
+
+ emptyuint32matrix-v6.mat
+
+ emptyuint8matrix-v6.mat
+
+ eye100x100-v6.mat
+
+ int16colvector-v6.mat
+
+ int16matrix-v6.mat
+
+ int16rowvector-v6.mat
+
+ int16scalar-v6.mat
+
+ int32colvector-v6.mat
+
+ int32matrix-v6.mat
+
+ int32rowvector-v6.mat
+
+ int32scalar-v6.mat
+
+ int8colvector-v6.mat
+
+ int8matrix-v6.mat
+
+ int8rowvector-v6.mat
+
+ int8scalar-v6.mat
+
+ realcolvectorsparse-v6.mat
+
+ realdoubleNDarray-v6.mat
+
+ realdoublecolvector-v6.mat
+
+ realdoublematrix-v6.mat
+
+ realdoublerowvector-v6.mat
+
+ realdoublescalar-v6.mat
+
+ realmatrixsparse-v6.mat
+
+ realrowvectorsparse-v6.mat
+
+ realscalarsparse-v6.mat
+
+ rowcell-v6.mat
+
+ rowstruct-v6.mat
+
+ scalarcell-v6.mat
+
+ scalarstruct-v6.mat
+
+ stringcell-v6.mat
+
+ stringcolvector-v6.mat
+
+ stringmatrix-v6.mat
+
+ stringrowvector-v6.mat
+
+ stringscalar-v6.mat
+
+ uint16colvector-v6.mat
+
+ uint16matrix-v6.mat
+
+ uint16rowvector-v6.mat
+
+ uint16scalar-v6.mat
+
+ uint32colvector-v6.mat
+
+ uint32matrix-v6.mat
+
+ uint32rowvector-v6.mat
+
+ uint32scalar-v6.mat
+
+ uint8colvector-v6.mat
+
+ uint8matrix-v6.mat
+
+ uint8rowvector-v6.mat
+
+ uint8scalar-v6.mat
+
+ arraycell-v7.mat
+
+ arraystruct-v7.mat
+
+ colcell-v7.mat
+
+ colstruct-v7.mat
+
+ complexdoubleNDarray-v7.mat
+
+ cplxdoublecolvector-v7.mat
+
+ cplxdoublematrix-v7.mat
+
+ cplxdoublerowvector-v7.mat
+
+ cplxdoublescalar-v7.mat
+
+ emptyNDarray-v7.mat
+
+ emptycell-v7.mat
+
+ emptydoublematrix-v7.mat
+
+ emptyint16matrix-v7.mat
+
+ emptyint32matrix-v7.mat
+
+ emptyint8matrix-v7.mat
+
+ emptysparse-v7.mat
+
+ emptystringmatrix-v7.mat
+
+ emptystruct-v7.mat
+
+ emptyuint16matrix-v7.mat
+
+ emptyuint32matrix-v7.mat
+
+ emptyuint8matrix-v7.mat
+
+ eye100x100-v7.mat
+
+ int16colvector-v7.mat
+
+ int16matrix-v7.mat
+
+ int16rowvector-v7.mat
+
+ int16scalar-v7.mat
+
+ int32colvector-v7.mat
+
+ int32matrix-v7.mat
+
+ int32rowvector-v7.mat
+
+ int32scalar-v7.mat
+
+ int8colvector-v7.mat
+
+ int8matrix-v7.mat
+
+ int8rowvector-v7.mat
+
+ int8scalar-v7.mat
+
+ realcolvectorsparse-v7.mat
+
+ realdoubleNDarray-v7.mat
+
+ realdoublecolvector-v7.mat
+
+ realdoublematrix-v7.mat
+
+ realdoublerowvector-v7.mat
+
+ realdoublescalar-v7.mat
+
+ realmatrixsparse-v7.mat
+
+ realrowvectorsparse-v7.mat
+
+ realscalarsparse-v7.mat
+
+ rowcell-v7.mat
+
+ rowstruct-v7.mat
+
+ scalarcell-v7.mat
+
+ scalarstruct-v7.mat
+
+ stringcell-v7.mat
+
+ stringcolvector-v7.mat
+
+ stringmatrix-v7.mat
+
+ stringrowvector-v7.mat
+
+ stringscalar-v7.mat
+
+ uint16colvector-v7.mat
+
+ uint16matrix-v7.mat
+
+ uint16rowvector-v7.mat
+
+ uint16scalar-v7.mat
+
+ uint32colvector-v7.mat
+
+ uint32matrix-v7.mat
+
+ uint32rowvector-v7.mat
+
+ uint32scalar-v7.mat
+
+ uint8colvector-v7.mat
+
+ uint8matrix-v7.mat
+
+ uint8rowvector-v7.mat
+
+ uint8scalar-v7.mat
+// TODO: read all variables from a single file ?
diff --git a/modules/matio/tests/unit_tests/loadmatfile.tst b/modules/matio/tests/unit_tests/loadmatfile.tst
new file mode 100755
index 000000000..3a22b35e0
--- /dev/null
+++ b/modules/matio/tests/unit_tests/loadmatfile.tst
@@ -0,0 +1,252 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Vincent Couvert <vincent.couvert@inria.fr>
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+// This Scilab script loads MAT-files to test the MATIO module
+
+clear all
+
+//
+// Loads all MAT-files
+//
+
+binFormats = ["-v4";"-v6";"-v7"];
+for formatIndex = 1:size(binFormats, "*")
+ matFiles = gsort(listfiles("SCI/modules/matio/tests/unit_tests/*" + binFormats(formatIndex) + ".mat"), "r", "i");
+ for fileIndex=1:size(matFiles, "*")
+ disp(fileparts(matFiles(fileIndex), "fname") + fileparts(matFiles(fileIndex), "extension"));
+ loadmatfile(matFiles(fileIndex));
+ end
+
+ //
+ // TESTS FOR CELL ARRAYS
+ //
+ if binFormats(formatIndex) <> "-v4" then // Cell arrays can not be stored in Matlab 4 binary files
+
+ assert_checkequal(emptycell , cell());
+ assert_checkequal(scalarcell , makecell([1 1], 1.23));
+ assert_checkequal(rowcell , makecell([1 3], "abc", [1.23+7.89*%i 4.56-1.23*%i 7.89+4.56*%i], 1.23));
+ assert_checkequal(colcell , makecell([3 1], [1.23+7.89*%i 4.56-1.23*%i 7.89+4.56*%i], "abc", 1.23));
+ assert_checkequal(arraycell , makecell([2 3], "a", [1.23+7.89*%i 4.56-1.23*%i 7.89+4.56*%i], int8(1), "abc", 1.23, eye(100,100)));
+ assert_checkequal(stringcell , makecell([2 3], "abc", "def", "ghi", "jkl", "mno", "pqr"));
+
+ clear emptycell scalarcell rowcell colcell arraycell stringcell
+ end
+
+ //
+ // TESTS FOR STRUCTURE ARRAYS
+ //
+ if binFormats(formatIndex) <> "-v4" then // Struct arrays can not be stored in Matlab 4 binary files
+
+ sciemptystruct = struct();
+ assert_checkequal(emptystruct , sciemptystruct);
+
+ sciscalarstruct = struct("f1", 10, "ftwo", "Hello", "field3", int8(12));
+ assert_checkequal(scalarstruct , sciscalarstruct);
+
+ scirowstruct = struct("field1", 10, "field2", "Hello", "field3", int8(12));
+ scirowstruct(1,2).field1 = "test";
+ scirowstruct(1,2).field2 = eye(10, 10);
+ scirowstruct(1,3).field2 = "a field contents";
+ scirowstruct(1,3).field3 = 1.23+4.56*%i;
+ assert_checkequal(rowstruct , scirowstruct);
+
+ scicolstruct = struct("name", 10, "phone", "Hello", "address", int8(12));
+ scicolstruct(2,1).name = "test";
+ scicolstruct(2,1).phone = eye(10, 10);
+ scicolstruct(3,1).phone = "a field contents";
+ scicolstruct(3,1).address = 1.23+4.56*%i;
+ assert_checkequal(colstruct , scicolstruct);
+
+ sciarraystruct = struct("field1", 10, "field2", "Hello", "field3", int8(12));
+ sciarraystruct(1,2).field1 = "test";
+ sciarraystruct(1,2).field2 = eye(10, 10);
+ sciarraystruct(1,3).field2 = "a field contents";
+ sciarraystruct(1,3).field3 = 1.23+4.56*%i;
+ sciarraystruct(2,1).name = "test";
+ sciarraystruct(2,1).phone = eye(10, 10);
+ sciarraystruct(3,1).phone = "a field contents";
+ sciarraystruct(3,1).address = 1.23+4.56*%i;
+ assert_checkequal(arraystruct , sciarraystruct);
+
+ clear emptystruct scalarstruct rowstruct colstruct arraystruct
+ clear sciemptystruct sciscalarstruct scirowstruct scicolstruct sciarraystruct
+
+ end
+
+ //
+ // TESTS FOR OBJECTS
+ //
+
+ // TODO
+
+ //
+ // TESTS FOR CHARACTER ARRAYS
+ //
+
+ assert_checkequal(emptystringmatrix , "");
+ assert_checkequal(stringscalar , "a");
+ assert_checkequal(stringrowvector , ["abc"]);
+ assert_checkequal(stringcolvector , ["a";"b";"c"]);
+ assert_checkequal(stringmatrix , ["abc";"def"]);
+
+ clear emptystringmatrix stringscalar stringrowvector stringcolvector stringmatrix
+
+ //
+ // TESTS FOR DOUBLE PRECISION ARRAYS
+ //
+
+ assert_checkequal(emptydoublematrix , []);
+
+ assert_checkequal(realdoublescalar , 1.23);
+ assert_checkequal(cplxdoublescalar , 1.23 + 4.56*%i);
+
+ assert_checkequal(realdoublerowvector , [1.23 -4.56 7.89]);
+ assert_checkequal(cplxdoublerowvector , [1.23+7.89*%i 4.56-1.23*%i 7.89+4.56*%i]);
+
+ assert_checkequal(realdoublecolvector , [1.23;-4.56;7.89]);
+ assert_checkequal(cplxdoublecolvector , [1.23+7.89*%i;4.56-1.23*%i;7.89+4.56*%i]);
+
+ assert_checkequal(realdoublematrix , [1.23 -4.56 7.89;9.87 6.54 -3.21]);
+ assert_checkequal(cplxdoublematrix , [1.23+7.89*%i 4.56-1.23*%i 7.89+4.56*%i;9.87+3.21*%i 6.54+9.87*%i 3.21-6.54*%i]);
+
+ clear emptydoublematrix realdoublescalar cplxdoublescalar realdoublerowvector cplxdoublerowvector realdoublecolvector cplxdoublecolvector realdoublematrix cplxdoublematrix
+
+ //
+ // TESTS FOR SINGLE PRECISION ARRAYS
+ //
+
+ // TODO
+
+ //
+ // TESTS FOR SPARSE MATRICES
+ //
+
+ if binFormats(formatIndex) <> "-v4" then // Integers can not be stored in Matlab 4 binary files
+ assert_checkequal(emptysparse , []);
+
+ assert_checkequal(realscalarsparse , sparse(1.23));
+ //assert_checkequal(cplxscalarsparse , sparse(1.23 + 4.56i));
+
+ assert_checkequal(realrowvectorsparse , sparse([1.23 0 7.89]));
+ //assert_checkequal(cplxrowvectorsparse , sparse([1.23+7.89i 0 7.89+4.56i]));
+
+ assert_checkequal(realcolvectorsparse , sparse([1.23;0;7.89]));
+ //assert_checkequal(cplxcolvectorsparse , sparse([1.23+7.89i;;7.89+4.56i]));
+
+ assert_checkequal(realmatrixsparse , sparse([1.23 0 7.89;0 6.54 -3.21]));
+ //assert_checkequal(cplxmatrixsparse , sparse([1.23+7.89i 0 7.89+4.56i;0 6.54+9.87i 3.21-6.54i]));
+end
+ if binFormats(formatIndex) <> "-v4" then // Integers can not be stored in Matlab 4 binary files
+
+ //
+ // TESTS FOR 8-BITS SIGNED INTEGERS
+ //
+
+ assert_checkequal(emptyint8matrix , int8([]));
+ assert_checkequal(int8scalar , int8(1));
+ assert_checkequal(int8rowvector , int8([1 -4 7]));
+ assert_checkequal(int8colvector , int8([1;-4;7]));
+ assert_checkequal(int8matrix , int8([1 -4 7;-9 6 -3]));
+
+ clear emptyint8matrix int8scalar int8rowvector int8colvector int8matrix
+
+ //
+ // TESTS FOR 16-BITS SIGNED INTEGERS
+ //
+
+ assert_checkequal(emptyint16matrix , int16([]));
+ assert_checkequal(int16scalar , int16(1));
+ assert_checkequal(int16rowvector , int16([1 -4 7]));
+ assert_checkequal(int16colvector , int16([1;-4;7]));
+ assert_checkequal(int16matrix , int16([1 -4 7;-9 6 -3]));
+
+ clear emptyint16matrix int16scalar int16rowvector int16colvector int16matrix
+
+ //
+ // TESTS FOR 32-BITS SIGNED INTEGERS
+ //
+
+ assert_checkequal(emptyint32matrix , int32([]));
+ assert_checkequal(int32scalar , int32(1));
+ assert_checkequal(int32rowvector , int32([1 -4 7]));
+ assert_checkequal(int32colvector , int32([1;-4;7]));
+ assert_checkequal(int32matrix , int32([1 -4 7;-9 6 -3]));
+
+ clear emptyint32matrix int32scalar int32rowvector int32colvector int32matrix
+
+ // TODO: int64 tests ?
+
+ //
+ // TESTS FOR 8-BITS UNSIGNED INTEGERS
+ //
+
+ assert_checkequal(emptyuint8matrix , uint8([]));
+ assert_checkequal(uint8scalar , uint8(1));
+ //assert_checkequal(uint8rowvector , uint8([1 -4 7]));
+ assert_checkequal(uint8rowvector , uint8([1 0 7]));
+ //assert_checkequal(uint8colvector , uint8([1;-4;7]));
+ assert_checkequal(uint8colvector , uint8([1;0;7]));
+ //assert_checkequal(uint8matrix , uint8([1 -4 7;-9 6 -3]));
+ assert_checkequal(uint8matrix , uint8([1 0 7;0 6 0]));
+
+ clear emptyuint8matrix uint8scalar uint8rowvector uint8colvector uint8matrix
+
+ //
+ // TESTS FOR 16-BITS UNSIGNED INTEGERS
+ //
+
+ assert_checkequal(emptyuint16matrix , uint16([]));
+ assert_checkequal(uint16scalar , uint16(1));
+ //assert_checkequal(uint16rowvector , uint16([1 -4 7]));
+ assert_checkequal(uint16rowvector , uint16([1 0 7]));
+ //assert_checkequal(uint16colvector , uint16([1;-4;7]));
+ assert_checkequal(uint16colvector , uint16([1;0;7]));
+ //assert_checkequal(uint16matrix , uint16([1 -4 7;-9 6 -3]));
+ assert_checkequal(uint16matrix , uint16([1 0 7;0 6 0]));
+
+ clear emptyuint16matrix uint16scalar uint16rowvector uint16colvector uint16matrix
+
+ //
+ // TESTS FOR 32-BITS UNSIGNED INTEGERS
+ //
+
+ assert_checkequal(emptyuint32matrix , uint32([]));
+ assert_checkequal(uint32scalar , uint32(1));
+ //assert_checkequal(uint32rowvector , uint32([1 -4 7]));
+ assert_checkequal(uint32rowvector , uint32([1 0 7]));
+ //assert_checkequal(uint32colvector , uint32([1;-4;7]));
+ assert_checkequal(uint32colvector , uint32([1;0;7]));
+ //assert_checkequal(uint32matrix , uint32([1 -4 7;-9 6 -3]));
+ assert_checkequal(uint32matrix , uint32([1 0 7;0 6 0]));
+
+ clear emptyuint32matrix uint32scalar uint32rowvector uint32colvector uint32matrix
+
+ // TODO: uint64 tests ?
+
+
+ //
+ // TESTS FOR ND-ARRAYS
+ //
+ assert_checkequal(emptyNDarray.dims , int32([0 0 0]));
+ assert_checkequal(emptyNDarray.entries , []);
+ assert_checkequal(realdoubleNDarray , matrix(1:24, 2, 3, 4));
+ assert_checkequal(complexdoubleNDarray , matrix((1:24) + (1:24)*%i, 2, 3, 4));
+
+ clear emptyNDarray realdoubleNDarray complexdoubleNDarray
+
+ end
+
+ //
+ // MISC
+ //
+ assert_checkequal(eye100x100 , eye(100,100));
+
+end
+
+// TODO: read all variables from a single file ?
diff --git a/modules/matio/tests/unit_tests/matfile_close.dia.ref b/modules/matio/tests/unit_tests/matfile_close.dia.ref
new file mode 100755
index 000000000..e70df8e64
--- /dev/null
+++ b/modules/matio/tests/unit_tests/matfile_close.dia.ref
@@ -0,0 +1,19 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - S/E - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+filename=TMPDIR+"/test_matfile.mat";
+A = rand(10,10);
+B = sprand(100,100,0.1);
+savematfile(filename,'A','B','-v6');
+clear();
+filename=TMPDIR+"/test_matfile.mat";
+fd = matfile_open(filename);
+assert_checkequal(fd, 0);
+assert_checkequal(matfile_close(fd), %t);
+assert_checktrue(isfile(filename));
+assert_checkequal(matfile_close(fd), %f);
+File already closed.
diff --git a/modules/matio/tests/unit_tests/matfile_close.tst b/modules/matio/tests/unit_tests/matfile_close.tst
new file mode 100755
index 000000000..5b0f2e7aa
--- /dev/null
+++ b/modules/matio/tests/unit_tests/matfile_close.tst
@@ -0,0 +1,21 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - S/E - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+filename=TMPDIR+"/test_matfile.mat";
+
+A = rand(10,10);
+B = sprand(100,100,0.1);
+savematfile(filename,'A','B','-v6');
+clear();
+filename=TMPDIR+"/test_matfile.mat";
+fd = matfile_open(filename);
+assert_checkequal(fd, 0);
+assert_checkequal(matfile_close(fd), %t);
+assert_checktrue(isfile(filename));
+assert_checkequal(matfile_close(fd), %f);
diff --git a/modules/matio/tests/unit_tests/matfile_listvar.dia.ref b/modules/matio/tests/unit_tests/matfile_listvar.dia.ref
new file mode 100755
index 000000000..fbb212dd1
--- /dev/null
+++ b/modules/matio/tests/unit_tests/matfile_listvar.dia.ref
@@ -0,0 +1,30 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - S/E - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+filename=TMPDIR+"/test_matfile.mat";
+A = rand(10,10);
+B = sprand(100,100,0.1);
+C = "foo";
+D = "bar";
+savematfile(filename,'A','B','C','D','-v6');
+clear();
+filename=TMPDIR+"/test_matfile.mat";
+fd = matfile_open(filename);
+[name, classes, types]=matfile_listvar(fd);
+assert_checkequal(matfile_close(fd), %t);
+assert_checkequal(name(1), "A");
+assert_checkequal(name(2), "B");
+assert_checkequal(name(3), "C");
+assert_checkequal(name(4), "D");
+assert_checkequal(types(1), 9);
+assert_checkequal(types(2), 9);
+assert_checkequal(types(3), 2);
+assert_checkequal(types(4), 2);
+assert_checkequal(classes(1), 6);
+assert_checkequal(classes(2), 5);
+assert_checkequal(classes(3), 4);
+assert_checkequal(classes(4), 4);
diff --git a/modules/matio/tests/unit_tests/matfile_listvar.tst b/modules/matio/tests/unit_tests/matfile_listvar.tst
new file mode 100755
index 000000000..85236895a
--- /dev/null
+++ b/modules/matio/tests/unit_tests/matfile_listvar.tst
@@ -0,0 +1,36 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - S/E - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+filename=TMPDIR+"/test_matfile.mat";
+
+A = rand(10,10);
+B = sprand(100,100,0.1);
+C = "foo";
+D = "bar";
+savematfile(filename,'A','B','C','D','-v6');
+clear();
+filename=TMPDIR+"/test_matfile.mat";
+fd = matfile_open(filename);
+[name, classes, types]=matfile_listvar(fd);
+assert_checkequal(matfile_close(fd), %t);
+
+assert_checkequal(name(1), "A");
+assert_checkequal(name(2), "B");
+assert_checkequal(name(3), "C");
+assert_checkequal(name(4), "D");
+
+assert_checkequal(types(1), 9);
+assert_checkequal(types(2), 9);
+assert_checkequal(types(3), 2);
+assert_checkequal(types(4), 2);
+
+assert_checkequal(classes(1), 6);
+assert_checkequal(classes(2), 5);
+assert_checkequal(classes(3), 4);
+assert_checkequal(classes(4), 4);
diff --git a/modules/matio/tests/unit_tests/matfile_open.dia.ref b/modules/matio/tests/unit_tests/matfile_open.dia.ref
new file mode 100755
index 000000000..30cb4752c
--- /dev/null
+++ b/modules/matio/tests/unit_tests/matfile_open.dia.ref
@@ -0,0 +1,17 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - S/E - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+filename=TMPDIR+"/test_matfile.mat";
+A = rand(10,10);
+B = sprand(100,100,0.1);
+savematfile(filename,'A','B','-v6');
+clear();
+filename=TMPDIR+"/test_matfile.mat";
+fd = matfile_open(filename);
+assert_checkequal(fd, 0);
+matfile_close(fd);
+assert_checktrue(isfile(filename));
diff --git a/modules/matio/tests/unit_tests/matfile_open.tst b/modules/matio/tests/unit_tests/matfile_open.tst
new file mode 100755
index 000000000..45ca5ff2c
--- /dev/null
+++ b/modules/matio/tests/unit_tests/matfile_open.tst
@@ -0,0 +1,20 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - S/E - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+filename=TMPDIR+"/test_matfile.mat";
+
+A = rand(10,10);
+B = sprand(100,100,0.1);
+savematfile(filename,'A','B','-v6');
+clear();
+filename=TMPDIR+"/test_matfile.mat";
+fd = matfile_open(filename);
+assert_checkequal(fd, 0);
+matfile_close(fd);
+assert_checktrue(isfile(filename));
diff --git a/modules/matio/tests/unit_tests/matfile_varreadnext.dia.ref b/modules/matio/tests/unit_tests/matfile_varreadnext.dia.ref
new file mode 100755
index 000000000..dc1d16ad8
--- /dev/null
+++ b/modules/matio/tests/unit_tests/matfile_varreadnext.dia.ref
@@ -0,0 +1,31 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - S/E - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+filename=TMPDIR+"/test_matfile.mat";
+A = rand(10,10);
+B = sprand(100,100,0.1);
+C = "foo";
+D = "bar";
+savematfile(filename,'A','B','C','D','-v6');
+fd = matfile_open(filename);
+[Name, Value, Type] = matfile_varreadnext(fd);
+assert_checkequal(Name, "A");
+assert_checkequal(Value, A);
+assert_checkequal(Type, 6);
+[Name, Value, Type] = matfile_varreadnext(fd);
+assert_checkequal(Name, "B");
+assert_checkequal(Value, B);
+assert_checkequal(Type, 5);
+[Name, Value, Type] = matfile_varreadnext(fd);
+assert_checkequal(Name, "C");
+assert_checkequal(Value, "foo");
+assert_checkequal(Type, 4);
+[Name, Value, Type] = matfile_varreadnext(fd);
+assert_checkequal(Name, "D");
+assert_checkequal(Value, "bar");
+assert_checkequal(Type, 4);
+assert_checkequal(matfile_close(fd), %t);
diff --git a/modules/matio/tests/unit_tests/matfile_varreadnext.tst b/modules/matio/tests/unit_tests/matfile_varreadnext.tst
new file mode 100755
index 000000000..60a54e74a
--- /dev/null
+++ b/modules/matio/tests/unit_tests/matfile_varreadnext.tst
@@ -0,0 +1,39 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - S/E - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+filename=TMPDIR+"/test_matfile.mat";
+
+A = rand(10,10);
+B = sprand(100,100,0.1);
+C = "foo";
+D = "bar";
+savematfile(filename,'A','B','C','D','-v6');
+fd = matfile_open(filename);
+
+[Name, Value, Type] = matfile_varreadnext(fd);
+assert_checkequal(Name, "A");
+assert_checkequal(Value, A);
+assert_checkequal(Type, 6);
+
+[Name, Value, Type] = matfile_varreadnext(fd);
+assert_checkequal(Name, "B");
+assert_checkequal(Value, B);
+assert_checkequal(Type, 5);
+
+[Name, Value, Type] = matfile_varreadnext(fd);
+assert_checkequal(Name, "C");
+assert_checkequal(Value, "foo");
+assert_checkequal(Type, 4);
+
+[Name, Value, Type] = matfile_varreadnext(fd);
+assert_checkequal(Name, "D");
+assert_checkequal(Value, "bar");
+assert_checkequal(Type, 4);
+
+assert_checkequal(matfile_close(fd), %t); \ No newline at end of file
diff --git a/modules/matio/tests/unit_tests/matfile_varwrite.dia.ref b/modules/matio/tests/unit_tests/matfile_varwrite.dia.ref
new file mode 100755
index 000000000..ab88ab664
--- /dev/null
+++ b/modules/matio/tests/unit_tests/matfile_varwrite.dia.ref
@@ -0,0 +1,21 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - S/E - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+filename=TMPDIR+"/test_matfile.mat";
+fd = matfile_open(filename,"w");
+matfile_varwrite(fd, "foo", "bar", %t);
+A=rand(10,10);
+matfile_varwrite(fd, "a", A, %t);
+matfile_close(fd);
+assert_checktrue(isfile(filename));
+fd = matfile_open(filename);
+assert_checkequal(matfile_listvar(fd),["foo";"a"]);
+matfile_close(fd);
+assert_checktrue(isfile(filename));
+loadmatfile(filename);
+assert_checkequal(foo,"bar");
+assert_checkequal(a,A);
diff --git a/modules/matio/tests/unit_tests/matfile_varwrite.tst b/modules/matio/tests/unit_tests/matfile_varwrite.tst
new file mode 100755
index 000000000..f0c32373c
--- /dev/null
+++ b/modules/matio/tests/unit_tests/matfile_varwrite.tst
@@ -0,0 +1,25 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - S/E - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+filename=TMPDIR+"/test_matfile.mat";
+fd = matfile_open(filename,"w");
+matfile_varwrite(fd, "foo", "bar", %t);
+A=rand(10,10);
+matfile_varwrite(fd, "a", A, %t);
+matfile_close(fd);
+assert_checktrue(isfile(filename));
+
+fd = matfile_open(filename);
+assert_checkequal(matfile_listvar(fd),["foo";"a"]);
+matfile_close(fd);
+assert_checktrue(isfile(filename));
+
+loadmatfile(filename);
+assert_checkequal(foo,"bar");
+assert_checkequal(a,A);
diff --git a/modules/matio/tests/unit_tests/realcolvectorsparse-v6.mat b/modules/matio/tests/unit_tests/realcolvectorsparse-v6.mat
new file mode 100755
index 000000000..f6d68a52c
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realcolvectorsparse-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/realcolvectorsparse-v7.mat b/modules/matio/tests/unit_tests/realcolvectorsparse-v7.mat
new file mode 100755
index 000000000..c9d64b44b
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realcolvectorsparse-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/realdoubleNDarray-v6.mat b/modules/matio/tests/unit_tests/realdoubleNDarray-v6.mat
new file mode 100755
index 000000000..9a41440d0
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realdoubleNDarray-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/realdoubleNDarray-v7.mat b/modules/matio/tests/unit_tests/realdoubleNDarray-v7.mat
new file mode 100755
index 000000000..a9ca3ae23
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realdoubleNDarray-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/realdoublecolvector-v4.mat b/modules/matio/tests/unit_tests/realdoublecolvector-v4.mat
new file mode 100755
index 000000000..f753d7ecd
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realdoublecolvector-v4.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/realdoublecolvector-v6.mat b/modules/matio/tests/unit_tests/realdoublecolvector-v6.mat
new file mode 100755
index 000000000..b1897d5dc
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realdoublecolvector-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/realdoublecolvector-v7.mat b/modules/matio/tests/unit_tests/realdoublecolvector-v7.mat
new file mode 100755
index 000000000..21eb767fc
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realdoublecolvector-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/realdoublematrix-v4.mat b/modules/matio/tests/unit_tests/realdoublematrix-v4.mat
new file mode 100755
index 000000000..a48ab81d9
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realdoublematrix-v4.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/realdoublematrix-v6.mat b/modules/matio/tests/unit_tests/realdoublematrix-v6.mat
new file mode 100755
index 000000000..44aea267a
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realdoublematrix-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/realdoublematrix-v7.mat b/modules/matio/tests/unit_tests/realdoublematrix-v7.mat
new file mode 100755
index 000000000..b78bfe922
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realdoublematrix-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/realdoublerowvector-v4.mat b/modules/matio/tests/unit_tests/realdoublerowvector-v4.mat
new file mode 100755
index 000000000..55a22d5e1
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realdoublerowvector-v4.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/realdoublerowvector-v6.mat b/modules/matio/tests/unit_tests/realdoublerowvector-v6.mat
new file mode 100755
index 000000000..bc3adac26
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realdoublerowvector-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/realdoublerowvector-v7.mat b/modules/matio/tests/unit_tests/realdoublerowvector-v7.mat
new file mode 100755
index 000000000..cf24a0b4e
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realdoublerowvector-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/realdoublescalar-v4.mat b/modules/matio/tests/unit_tests/realdoublescalar-v4.mat
new file mode 100755
index 000000000..02e4ae9bd
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realdoublescalar-v4.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/realdoublescalar-v6.mat b/modules/matio/tests/unit_tests/realdoublescalar-v6.mat
new file mode 100755
index 000000000..b49049059
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realdoublescalar-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/realdoublescalar-v7.mat b/modules/matio/tests/unit_tests/realdoublescalar-v7.mat
new file mode 100755
index 000000000..c324f05bb
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realdoublescalar-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/realmatrixsparse-v6.mat b/modules/matio/tests/unit_tests/realmatrixsparse-v6.mat
new file mode 100755
index 000000000..d2f105304
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realmatrixsparse-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/realmatrixsparse-v7.mat b/modules/matio/tests/unit_tests/realmatrixsparse-v7.mat
new file mode 100755
index 000000000..4885b45b2
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realmatrixsparse-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/realrowvectorsparse-v6.mat b/modules/matio/tests/unit_tests/realrowvectorsparse-v6.mat
new file mode 100755
index 000000000..628392e44
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realrowvectorsparse-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/realrowvectorsparse-v7.mat b/modules/matio/tests/unit_tests/realrowvectorsparse-v7.mat
new file mode 100755
index 000000000..0ef9c8fcf
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realrowvectorsparse-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/realscalarsparse-v6.mat b/modules/matio/tests/unit_tests/realscalarsparse-v6.mat
new file mode 100755
index 000000000..be4357979
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realscalarsparse-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/realscalarsparse-v7.mat b/modules/matio/tests/unit_tests/realscalarsparse-v7.mat
new file mode 100755
index 000000000..f8216f5d6
--- /dev/null
+++ b/modules/matio/tests/unit_tests/realscalarsparse-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/rowcell-v6.mat b/modules/matio/tests/unit_tests/rowcell-v6.mat
new file mode 100755
index 000000000..ab0a7bc20
--- /dev/null
+++ b/modules/matio/tests/unit_tests/rowcell-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/rowcell-v7.mat b/modules/matio/tests/unit_tests/rowcell-v7.mat
new file mode 100755
index 000000000..6c8ad7cae
--- /dev/null
+++ b/modules/matio/tests/unit_tests/rowcell-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/rowstruct-v6.mat b/modules/matio/tests/unit_tests/rowstruct-v6.mat
new file mode 100755
index 000000000..e8f83db1a
--- /dev/null
+++ b/modules/matio/tests/unit_tests/rowstruct-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/rowstruct-v7.mat b/modules/matio/tests/unit_tests/rowstruct-v7.mat
new file mode 100755
index 000000000..4123cf5c6
--- /dev/null
+++ b/modules/matio/tests/unit_tests/rowstruct-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/savematfile.dia.ref b/modules/matio/tests/unit_tests/savematfile.dia.ref
new file mode 100755
index 000000000..f37077d98
--- /dev/null
+++ b/modules/matio/tests/unit_tests/savematfile.dia.ref
@@ -0,0 +1,179 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Vincent Couvert <vincent.couvert@inria.fr>
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// This Scilab script saves MAT-files to test the MATIO module
+chdir("SCI/modules/matio/tests/unit_tests/")
+ ans =
+
+ T
+clear
+names=who('local');
+//
+// TESTS FOR CELL ARRAYS
+//
+//--emptycell = cell();
+scalarcell = makecell([1 1], 1.23);
+//--rowcell = makecell([1 3], "abc", [1.23+7.89*%i 4.56-1.23*%i 7.89+4.56*%i], 1.23);
+//--colcell = makecell([3 1], [1.23+7.89*%i 4.56-1.23*%i 7.89+4.56*%i], "abc", 1.23);
+//--arraycell = makecell([2 3], "a", [1.23+7.89*%i 4.56-1.23*%i 7.89+4.56*%i], int8(1), "abc", 1.23, eye(100,100));
+//--stringcell = makecell([2 3], "abc", "def", "ghi", "jkl", "mno", "pqr");
+//
+// TESTS FOR STRUCTURE ARRAYS
+//
+//--emptystruct = struct();
+//--scalarstruct = struct('f1', 10, 'ftwo', 'Hello', 'field3', int8(12));
+//--rowstruct = struct('field1', 10, 'field2', 'Hello', 'field3', int8(12));
+//--rowstruct(1,2).field1 = 'test';
+//--rowstruct(1,2).field2 = eye(10, 10);
+//--rowstruct(1,3).field2 = 'a f*%ield contents';
+//--rowstruct(1,3).field3 = 1.23+4.56*%i;
+//--colstruct = struct('name', 10, 'phone', 'Hello', 'address', int8(12));
+//--colstruct(2,1).name = 'test';
+//--colstruct(2,1).phone = eye(10, 10);
+//--colstruct(3,1).phone = 'a f*%ield contents';
+//--colstruct(3,1).address = 1.23+4.56*%i;
+//--arraystruct = struct('field1', 10, 'field2', 'Hello', 'field3', int8(12));
+//--arraystruct(1,2).field1 = 'test';
+//--arraystruct(1,2).field2 = eye(10, 10);
+//--arraystruct(1,3).field2 = 'a field contents';
+//--arraystruct(1,3).field3 = 1.23+4.56*%i;
+//--arraystruct(2,1).name = 'test';
+//--arraystruct(2,1).phone = eye(10, 10);
+//--arraystruct(3,1).phone = 'a field contents';
+//--arraystruct(3,1).address = 1.23+4.56*%i;
+//
+// TESTS FOR OBJECTS
+//
+// TODO
+//
+// TESTS FOR CHARACTER ARRAYS
+//
+//--emptystringmatrix = ''; // Fails with -v7
+//--stringscalar = 'a'; // Fails with -v4
+//--stringrowvector = ['a' 'b' 'c']; // Fails with -v4
+//--stringcolvector = ['a';'b';'c']; // Fails with -v4
+//--stringmatrix = ['a' 'b' 'c';'d' 'e' 'f']; // Fails with -v4
+//
+// TESTS FOR DOUBLE PRECISION ARRAYS
+//
+emptydoublematrix = [];
+realdoublescalar = 1.23;
+cplxdoublescalar = 1.23 + 4.56*%i;
+realdoublerowvector = [1.23 -4.56 7.89];
+cplxdoublerowvector = [1.23+7.89*%i 4.56-1.23*%i 7.89+4.56*%i];
+realdoublecolvector = [1.23;-4.56;7.89];
+cplxdoublecolvector = [1.23+7.89*%i;4.56-1.23*%i;7.89+4.56*%i];
+realdoublematrix = [1.23 -4.56 7.89;9.87 6.54 -3.21];
+cplxdoublematrix = [1.23+7.89*%i 4.56-1.23*%i 7.89+4.56*%i;9.87+3.21*%i 6.54+9.87*%i 3.21-6.54*%i];
+//
+// TESTS FOR SINGLE PRECISION ARRAYS
+//
+// TODO
+//
+// TESTS FOR SPARSE MATRICES
+//
+// Tests for complex matr*%ices are not done because of a bug *%in MATIO
+emptysparse = sparse([]);
+//realscalarsparse = sparse(1.23);
+//cplxscalarsparse = sparse(1.23 + 4.56*%i);
+//--realrowvectorsparse = sparse([1.23 0 7.89]);
+//cplxrowvectorsparse = sparse([1.23+7.89*%i 0 7.89+4.56*%i]);
+//--realcolvectorsparse = sparse([1.23;0;7.89]);
+//cplxcolvectorsparse = sparse([1.23+7.89*%i;0;7.89+4.56*%i]);
+//--realmatrixsparse = sparse([1.23 0 7.89;0 6.54 -3.21]);
+//cplxmatrixsparse = sparse([1.23+7.89*%i 0 7.89+4.56*%i;0 6.54+9.87*%i 3.21-6.54*%i]);
+//
+// TESTS FOR 8-BITS SIGNED INTEGERS
+//
+emptyint8matrix = int8([]);
+int8scalar = int8(1);
+int8rowvector = int8([1 -4 7]);
+int8colvector = int8([1;-4;7]);
+int8matrix = int8([1 -4 7;-9 6 -3]);
+//
+// TESTS FOR 16-BITS SIGNED INTEGERS
+//
+emptyint16matrix = int16([]);
+int16scalar = int16(1);
+int16rowvector = int16([1 -4 7]);
+int16colvector = int16([1;-4;7]);
+int16matrix = int16([1 -4 7;-9 6 -3]);
+//
+// TESTS FOR 32-BITS SIGNED INTEGERS
+//
+emptyint32matrix = int32([]);
+int32scalar = int32(1);
+int32rowvector = int32([1 -4 7]);
+int32colvector = int32([1;-4;7]);
+int32matrix = int32([1 -4 7;-9 6 -3]);
+// TODO: int64 tests ?
+//
+// TESTS FOR 8-BITS UNSIGNED INTEGERS
+//
+emptyuint8matrix = uint8([]);
+uint8scalar = uint8(1);
+uint8rowvector = uint8([1 -4 7]);
+uint8colvector = uint8([1;-4;7]);
+uint8matrix = uint8([1 -4 7;-9 6 -3]);
+//
+// TESTS FOR 16-BITS UNSIGNED INTEGERS
+//
+emptyuint16matrix = uint16([]);
+uint16scalar = uint16(1);
+uint16rowvector = uint16([1 -4 7]);
+uint16colvector = uint16([1;-4;7]);
+uint16matrix = uint16([1 -4 7;-9 6 -3]);
+//
+// TESTS FOR 32-BITS UNSIGNED INTEGERS
+//
+emptyuint32matrix = uint32([]);
+uint32scalar = uint32(1);
+uint32rowvector = uint32([1 -4 7]);
+uint32colvector = uint32([1;-4;7]);
+uint32matrix = uint32([1 -4 7;-9 6 -3]);
+// TODO: uint64 tests ?
+//
+// TESTS FOR ND-ARRAYS
+//
+//emptyNDarray = matrix([], 0, 0, 0);
+//realdoubleNDarray = matrix(1:24, 2, 3, 4);
+//complexdoubleNDarray = matrix((1:24) + (1:24)*%i, 2, 3, 4);
+//
+// MISC
+//
+eye100x100 = eye(100,100);
+//
+// Create files
+//
+varNames = who("local");
+varNames = varNames(1:($-size(names,"*")-1));
+varNames(grep(varNames,"%")) = [];
+varNames(varNames=="makecell") = [];
+varNames(varNames=="struct") = [];
+binFormats = ["-v4";"-v6";"-v7"];
+for varIndex=1:size(varNames,"*")
+ for formatIndex=1:size(binFormats,"*")
+ // Integers and NDarrays not saved in -v4 format
+ if formatIndex>1 | ...
+ (formatIndex==1 & isempty(strindex(varNames(varIndex), "int")) ...
+ & isempty(strindex(varNames(varIndex), "NDarray")) & isempty(strindex(varNames(varIndex), "cell")) & isempty(strindex(varNames(varIndex), "struct")) & isempty(strindex(varNames(varIndex), "sparse")))
+ // Save data in Matlab format
+ filename = TMPDIR+filesep()+varNames(varIndex)+binFormats(formatIndex)+"-scilab.mat";
+ saveCmd = "savematfile "+filename+" "+varNames(varIndex)+" "+binFormats(formatIndex);
+ execstr(saveCmd);
+ // Read saved file
+ execstr("sci"+varNames(varIndex)+"="+varNames(varIndex)); // Save variable for comparison
+ execstr("clear "+varNames(varIndex)); // Clear variable
+ execstr("loadmatfile "+filename); // Load file contaning variable
+ execstr("compareOK=and(sci"+varNames(varIndex)+"=="+varNames(varIndex)+")"); // Compare
+ if ~compareOK then bugmes();quit;end // Stop execution if necessary
+ clear compareOK
+ mdelete(filename)
+ end
+ end
+end
+// TODO: save all variables in a single file ?
diff --git a/modules/matio/tests/unit_tests/savematfile.tst b/modules/matio/tests/unit_tests/savematfile.tst
new file mode 100755
index 000000000..05dd57e49
--- /dev/null
+++ b/modules/matio/tests/unit_tests/savematfile.tst
@@ -0,0 +1,218 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Vincent Couvert <vincent.couvert@inria.fr>
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+// This Scilab script saves MAT-files to test the MATIO module
+
+chdir("SCI/modules/matio/tests/unit_tests/")
+
+clear
+names=who('local');
+//
+// TESTS FOR CELL ARRAYS
+//
+//--emptycell = cell();
+scalarcell = makecell([1 1], 1.23);
+//--rowcell = makecell([1 3], "abc", [1.23+7.89*%i 4.56-1.23*%i 7.89+4.56*%i], 1.23);
+//--colcell = makecell([3 1], [1.23+7.89*%i 4.56-1.23*%i 7.89+4.56*%i], "abc", 1.23);
+//--arraycell = makecell([2 3], "a", [1.23+7.89*%i 4.56-1.23*%i 7.89+4.56*%i], int8(1), "abc", 1.23, eye(100,100));
+//--stringcell = makecell([2 3], "abc", "def", "ghi", "jkl", "mno", "pqr");
+
+//
+// TESTS FOR STRUCTURE ARRAYS
+//
+//--emptystruct = struct();
+//--scalarstruct = struct('f1', 10, 'ftwo', 'Hello', 'field3', int8(12));
+//--rowstruct = struct('field1', 10, 'field2', 'Hello', 'field3', int8(12));
+//--rowstruct(1,2).field1 = 'test';
+//--rowstruct(1,2).field2 = eye(10, 10);
+//--rowstruct(1,3).field2 = 'a f*%ield contents';
+//--rowstruct(1,3).field3 = 1.23+4.56*%i;
+//--colstruct = struct('name', 10, 'phone', 'Hello', 'address', int8(12));
+//--colstruct(2,1).name = 'test';
+//--colstruct(2,1).phone = eye(10, 10);
+//--colstruct(3,1).phone = 'a f*%ield contents';
+//--colstruct(3,1).address = 1.23+4.56*%i;
+//--arraystruct = struct('field1', 10, 'field2', 'Hello', 'field3', int8(12));
+//--arraystruct(1,2).field1 = 'test';
+//--arraystruct(1,2).field2 = eye(10, 10);
+//--arraystruct(1,3).field2 = 'a field contents';
+//--arraystruct(1,3).field3 = 1.23+4.56*%i;
+//--arraystruct(2,1).name = 'test';
+//--arraystruct(2,1).phone = eye(10, 10);
+//--arraystruct(3,1).phone = 'a field contents';
+//--arraystruct(3,1).address = 1.23+4.56*%i;
+
+//
+// TESTS FOR OBJECTS
+//
+
+// TODO
+
+//
+// TESTS FOR CHARACTER ARRAYS
+//
+
+//--emptystringmatrix = ''; // Fails with -v7
+//--stringscalar = 'a'; // Fails with -v4
+//--stringrowvector = ['a' 'b' 'c']; // Fails with -v4
+//--stringcolvector = ['a';'b';'c']; // Fails with -v4
+//--stringmatrix = ['a' 'b' 'c';'d' 'e' 'f']; // Fails with -v4
+
+//
+// TESTS FOR DOUBLE PRECISION ARRAYS
+//
+
+emptydoublematrix = [];
+
+realdoublescalar = 1.23;
+cplxdoublescalar = 1.23 + 4.56*%i;
+
+realdoublerowvector = [1.23 -4.56 7.89];
+cplxdoublerowvector = [1.23+7.89*%i 4.56-1.23*%i 7.89+4.56*%i];
+
+realdoublecolvector = [1.23;-4.56;7.89];
+cplxdoublecolvector = [1.23+7.89*%i;4.56-1.23*%i;7.89+4.56*%i];
+
+realdoublematrix = [1.23 -4.56 7.89;9.87 6.54 -3.21];
+cplxdoublematrix = [1.23+7.89*%i 4.56-1.23*%i 7.89+4.56*%i;9.87+3.21*%i 6.54+9.87*%i 3.21-6.54*%i];
+
+//
+// TESTS FOR SINGLE PRECISION ARRAYS
+//
+
+// TODO
+
+//
+// TESTS FOR SPARSE MATRICES
+//
+// Tests for complex matr*%ices are not done because of a bug *%in MATIO
+
+emptysparse = sparse([]);
+
+//realscalarsparse = sparse(1.23);
+//cplxscalarsparse = sparse(1.23 + 4.56*%i);
+
+//--realrowvectorsparse = sparse([1.23 0 7.89]);
+//cplxrowvectorsparse = sparse([1.23+7.89*%i 0 7.89+4.56*%i]);
+
+//--realcolvectorsparse = sparse([1.23;0;7.89]);
+//cplxcolvectorsparse = sparse([1.23+7.89*%i;0;7.89+4.56*%i]);
+
+//--realmatrixsparse = sparse([1.23 0 7.89;0 6.54 -3.21]);
+//cplxmatrixsparse = sparse([1.23+7.89*%i 0 7.89+4.56*%i;0 6.54+9.87*%i 3.21-6.54*%i]);
+
+//
+// TESTS FOR 8-BITS SIGNED INTEGERS
+//
+
+emptyint8matrix = int8([]);
+int8scalar = int8(1);
+int8rowvector = int8([1 -4 7]);
+int8colvector = int8([1;-4;7]);
+int8matrix = int8([1 -4 7;-9 6 -3]);
+
+//
+// TESTS FOR 16-BITS SIGNED INTEGERS
+//
+
+emptyint16matrix = int16([]);
+int16scalar = int16(1);
+int16rowvector = int16([1 -4 7]);
+int16colvector = int16([1;-4;7]);
+int16matrix = int16([1 -4 7;-9 6 -3]);
+
+//
+// TESTS FOR 32-BITS SIGNED INTEGERS
+//
+
+emptyint32matrix = int32([]);
+int32scalar = int32(1);
+int32rowvector = int32([1 -4 7]);
+int32colvector = int32([1;-4;7]);
+int32matrix = int32([1 -4 7;-9 6 -3]);
+
+// TODO: int64 tests ?
+
+//
+// TESTS FOR 8-BITS UNSIGNED INTEGERS
+//
+
+emptyuint8matrix = uint8([]);
+uint8scalar = uint8(1);
+uint8rowvector = uint8([1 -4 7]);
+uint8colvector = uint8([1;-4;7]);
+uint8matrix = uint8([1 -4 7;-9 6 -3]);
+
+//
+// TESTS FOR 16-BITS UNSIGNED INTEGERS
+//
+
+emptyuint16matrix = uint16([]);
+uint16scalar = uint16(1);
+uint16rowvector = uint16([1 -4 7]);
+uint16colvector = uint16([1;-4;7]);
+uint16matrix = uint16([1 -4 7;-9 6 -3]);
+
+//
+// TESTS FOR 32-BITS UNSIGNED INTEGERS
+//
+
+emptyuint32matrix = uint32([]);
+uint32scalar = uint32(1);
+uint32rowvector = uint32([1 -4 7]);
+uint32colvector = uint32([1;-4;7]);
+uint32matrix = uint32([1 -4 7;-9 6 -3]);
+
+// TODO: uint64 tests ?
+
+//
+// TESTS FOR ND-ARRAYS
+//
+//emptyNDarray = matrix([], 0, 0, 0);
+//realdoubleNDarray = matrix(1:24, 2, 3, 4);
+//complexdoubleNDarray = matrix((1:24) + (1:24)*%i, 2, 3, 4);
+
+//
+// MISC
+//
+eye100x100 = eye(100,100);
+
+//
+// Create files
+//
+varNames = who("local");
+varNames = varNames(1:($-size(names,"*")-1));
+varNames(grep(varNames,"%")) = [];
+varNames(varNames=="makecell") = [];
+varNames(varNames=="struct") = [];
+binFormats = ["-v4";"-v6";"-v7"];
+for varIndex=1:size(varNames,"*")
+ for formatIndex=1:size(binFormats,"*")
+ // Integers and NDarrays not saved in -v4 format
+ if formatIndex>1 | ...
+ (formatIndex==1 & isempty(strindex(varNames(varIndex), "int")) ...
+ & isempty(strindex(varNames(varIndex), "NDarray")) & isempty(strindex(varNames(varIndex), "cell")) & isempty(strindex(varNames(varIndex), "struct")) & isempty(strindex(varNames(varIndex), "sparse")))
+
+ // Save data in Matlab format
+ filename = TMPDIR+filesep()+varNames(varIndex)+binFormats(formatIndex)+"-scilab.mat";
+ saveCmd = "savematfile "+filename+" "+varNames(varIndex)+" "+binFormats(formatIndex);
+ execstr(saveCmd);
+ // Read saved file
+ execstr("sci"+varNames(varIndex)+"="+varNames(varIndex)); // Save variable for comparison
+ execstr("clear "+varNames(varIndex)); // Clear variable
+ execstr("loadmatfile "+filename); // Load file contaning variable
+ execstr("compareOK=and(sci"+varNames(varIndex)+"=="+varNames(varIndex)+")"); // Compare
+ if ~compareOK then pause;end // Stop execution if necessary
+ clear compareOK
+ mdelete(filename)
+ end
+ end
+end
+
+// TODO: save all variables in a single file ?
diff --git a/modules/matio/tests/unit_tests/scalarcell-v6.mat b/modules/matio/tests/unit_tests/scalarcell-v6.mat
new file mode 100755
index 000000000..9850b898d
--- /dev/null
+++ b/modules/matio/tests/unit_tests/scalarcell-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/scalarcell-v7.mat b/modules/matio/tests/unit_tests/scalarcell-v7.mat
new file mode 100755
index 000000000..27b8d7fe5
--- /dev/null
+++ b/modules/matio/tests/unit_tests/scalarcell-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/scalarstruct-v6.mat b/modules/matio/tests/unit_tests/scalarstruct-v6.mat
new file mode 100755
index 000000000..059848da8
--- /dev/null
+++ b/modules/matio/tests/unit_tests/scalarstruct-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/scalarstruct-v7.mat b/modules/matio/tests/unit_tests/scalarstruct-v7.mat
new file mode 100755
index 000000000..ca5627061
--- /dev/null
+++ b/modules/matio/tests/unit_tests/scalarstruct-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/stringcell-v6.mat b/modules/matio/tests/unit_tests/stringcell-v6.mat
new file mode 100755
index 000000000..de9f24d74
--- /dev/null
+++ b/modules/matio/tests/unit_tests/stringcell-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/stringcell-v7.mat b/modules/matio/tests/unit_tests/stringcell-v7.mat
new file mode 100755
index 000000000..a802c78a8
--- /dev/null
+++ b/modules/matio/tests/unit_tests/stringcell-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/stringcolvector-v4.mat b/modules/matio/tests/unit_tests/stringcolvector-v4.mat
new file mode 100755
index 000000000..76b15b401
--- /dev/null
+++ b/modules/matio/tests/unit_tests/stringcolvector-v4.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/stringcolvector-v6.mat b/modules/matio/tests/unit_tests/stringcolvector-v6.mat
new file mode 100755
index 000000000..5f67109ce
--- /dev/null
+++ b/modules/matio/tests/unit_tests/stringcolvector-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/stringcolvector-v7.mat b/modules/matio/tests/unit_tests/stringcolvector-v7.mat
new file mode 100755
index 000000000..cbaf5b277
--- /dev/null
+++ b/modules/matio/tests/unit_tests/stringcolvector-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/stringmatrix-v4.mat b/modules/matio/tests/unit_tests/stringmatrix-v4.mat
new file mode 100755
index 000000000..bca71b6fe
--- /dev/null
+++ b/modules/matio/tests/unit_tests/stringmatrix-v4.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/stringmatrix-v6.mat b/modules/matio/tests/unit_tests/stringmatrix-v6.mat
new file mode 100755
index 000000000..4eb18d68d
--- /dev/null
+++ b/modules/matio/tests/unit_tests/stringmatrix-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/stringmatrix-v7.mat b/modules/matio/tests/unit_tests/stringmatrix-v7.mat
new file mode 100755
index 000000000..f61db499b
--- /dev/null
+++ b/modules/matio/tests/unit_tests/stringmatrix-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/stringrowvector-v4.mat b/modules/matio/tests/unit_tests/stringrowvector-v4.mat
new file mode 100755
index 000000000..687a9dd9e
--- /dev/null
+++ b/modules/matio/tests/unit_tests/stringrowvector-v4.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/stringrowvector-v6.mat b/modules/matio/tests/unit_tests/stringrowvector-v6.mat
new file mode 100755
index 000000000..275e53f72
--- /dev/null
+++ b/modules/matio/tests/unit_tests/stringrowvector-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/stringrowvector-v7.mat b/modules/matio/tests/unit_tests/stringrowvector-v7.mat
new file mode 100755
index 000000000..f42f4415d
--- /dev/null
+++ b/modules/matio/tests/unit_tests/stringrowvector-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/stringscalar-v4.mat b/modules/matio/tests/unit_tests/stringscalar-v4.mat
new file mode 100755
index 000000000..c9a336477
--- /dev/null
+++ b/modules/matio/tests/unit_tests/stringscalar-v4.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/stringscalar-v6.mat b/modules/matio/tests/unit_tests/stringscalar-v6.mat
new file mode 100755
index 000000000..344db9923
--- /dev/null
+++ b/modules/matio/tests/unit_tests/stringscalar-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/stringscalar-v7.mat b/modules/matio/tests/unit_tests/stringscalar-v7.mat
new file mode 100755
index 000000000..a1ed7877a
--- /dev/null
+++ b/modules/matio/tests/unit_tests/stringscalar-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/testmatfiles.m b/modules/matio/tests/unit_tests/testmatfiles.m
new file mode 100755
index 000000000..1345901ba
--- /dev/null
+++ b/modules/matio/tests/unit_tests/testmatfiles.m
@@ -0,0 +1,204 @@
+% =============================================================================
+% Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+% Copyright (C) 2008 - INRIA - Vincent Couvert <vincent.couvert@inria.fr>
+%
+% This file is distributed under the same license as the Scilab package.
+% =============================================================================
+
+% This Matlab script generates MAT-files to test the MATIO module
+
+clear all
+
+%
+% TESTS FOR CELL ARRAYS
+%
+emptycell = {};
+scalarcell = {1.23};
+rowcell = {'abc', [1.23+7.89i 4.56-1.23i 7.89+4.56i], 1.23};
+colcell = {[1.23+7.89i 4.56-1.23i 7.89+4.56i]; 'abc'; 1.23};
+arraycell = {'a', [1.23+7.89i 4.56-1.23i 7.89+4.56i], int8(1); 'abc', 1.23, eye(100,100)};
+stringcell = {'abc', 'def', 'ghi';'jkl', 'mno', 'pqr'};
+
+%
+% TESTS FOR STRUCTURE ARRAYS
+%
+emptystruct = struct();
+scalarstruct = struct('f1', 10, 'ftwo', 'Hello', 'field3', int8(12));
+rowstruct = struct('field1', 10, 'field2', 'Hello', 'field3', int8(12));
+rowstruct(1,2).field1 = 'test';
+rowstruct(1,2).field2 = eye(10, 10);
+rowstruct(1,3).field2 = 'a field contents';
+rowstruct(1,3).field3 = 1.23+4.56i;
+colstruct = struct('name', 10, 'phone', 'Hello', 'address', int8(12));
+colstruct(2,1).name = 'test';
+colstruct(2,1).phone = eye(10, 10);
+colstruct(3,1).phone = 'a field contents';
+colstruct(3,1).address = 1.23+4.56i;
+arraystruct = struct('field1', 10, 'field2', 'Hello', 'field3', int8(12));
+arraystruct(1,2).field1 = 'test';
+arraystruct(1,2).field2 = eye(10, 10);
+arraystruct(1,3).field2 = 'a field contents';
+arraystruct(1,3).field3 = 1.23+4.56i;
+arraystruct(2,1).name = 'test';
+arraystruct(2,1).phone = eye(10, 10);
+arraystruct(3,1).phone = 'a field contents';
+arraystruct(3,1).address = 1.23+4.56i;
+
+%
+% TESTS FOR OBJECTS
+%
+
+% TODO
+
+%
+% TESTS FOR CHARACTER ARRAYS
+%
+
+emptystringmatrix = '';
+stringscalar = 'a';
+stringrowvector = ['a' 'b' 'c'];
+stringcolvector = ['a';'b';'c'];
+stringmatrix = ['a' 'b' 'c';'d' 'e' 'f'];
+
+%
+% TESTS FOR DOUBLE PRECISION ARRAYS
+%
+
+emptydoublematrix = [];
+
+realdoublescalar = 1.23;
+cplxdoublescalar = 1.23 + 4.56i;
+
+realdoublerowvector = [1.23 -4.56 7.89];
+cplxdoublerowvector = [1.23+7.89i 4.56-1.23i 7.89+4.56i];
+
+realdoublecolvector = [1.23;-4.56;7.89];
+cplxdoublecolvector = [1.23+7.89i;4.56-1.23i;7.89+4.56i];
+
+realdoublematrix = [1.23 -4.56 7.89;9.87 6.54 -3.21];
+cplxdoublematrix = [1.23+7.89i 4.56-1.23i 7.89+4.56i;9.87+3.21i 6.54+9.87i 3.21-6.54i];
+
+%
+% TESTS FOR SINGLE PRECISION ARRAYS
+%
+
+% TODO
+
+%
+% TESTS FOR SPARSE MATRICES
+%
+% Tests for complex matrices are not done because of a bug in MATIO
+
+emptysparse = sparse([]);
+
+realscalarsparse = sparse(1.23);
+%cplxscalarsparse = sparse(1.23 + 4.56i);
+
+realrowvectorsparse = sparse([1.23 0 7.89]);
+%cplxrowvectorsparse = sparse([1.23+7.89i 0 7.89+4.56i]);
+
+realcolvectorsparse = sparse([1.23;0;7.89]);
+%cplxcolvectorsparse = sparse([1.23+7.89i;0;7.89+4.56i]);
+
+realmatrixsparse = sparse([1.23 0 7.89;0 6.54 -3.21]);
+%cplxmatrixsparse = sparse([1.23+7.89i 0 7.89+4.56i;0 6.54+9.87i 3.21-6.54i]);
+
+%
+% TESTS FOR 8-BITS SIGNED INTEGERS
+%
+
+emptyint8matrix = int8([]);
+int8scalar = int8(1);
+int8rowvector = int8([1 -4 7]);
+int8colvector = int8([1;-4;7]);
+int8matrix = int8([1 -4 7;-9 6 -3]);
+
+%
+% TESTS FOR 16-BITS SIGNED INTEGERS
+%
+
+emptyint16matrix = int16([]);
+int16scalar = int16(1);
+int16rowvector = int16([1 -4 7]);
+int16colvector = int16([1;-4;7]);
+int16matrix = int16([1 -4 7;-9 6 -3]);
+
+%
+% TESTS FOR 32-BITS SIGNED INTEGERS
+%
+
+emptyint32matrix = int32([]);
+int32scalar = int32(1);
+int32rowvector = int32([1 -4 7]);
+int32colvector = int32([1;-4;7]);
+int32matrix = int32([1 -4 7;-9 6 -3]);
+
+% TODO: int64 tests ?
+
+%
+% TESTS FOR 8-BITS UNSIGNED INTEGERS
+%
+
+emptyuint8matrix = uint8([]);
+uint8scalar = uint8(1);
+uint8rowvector = uint8([1 -4 7]);
+uint8colvector = uint8([1;-4;7]);
+uint8matrix = uint8([1 -4 7;-9 6 -3]);
+
+%
+% TESTS FOR 16-BITS UNSIGNED INTEGERS
+%
+
+emptyuint16matrix = uint16([]);
+uint16scalar = uint16(1);
+uint16rowvector = uint16([1 -4 7]);
+uint16colvector = uint16([1;-4;7]);
+uint16matrix = uint16([1 -4 7;-9 6 -3]);
+
+%
+% TESTS FOR 32-BITS UNSIGNED INTEGERS
+%
+
+emptyuint32matrix = uint32([]);
+uint32scalar = uint32(1);
+uint32rowvector = uint32([1 -4 7]);
+uint32colvector = uint32([1;-4;7]);
+uint32matrix = uint32([1 -4 7;-9 6 -3]);
+
+% TODO: uint64 tests ?
+
+%
+% TESTS FOR ND-ARRAYS
+%
+emptyNDarray = reshape([], 0, 0, 0);
+realdoubleNDarray = reshape(1:24, 2, 3, 4);
+complexdoubleNDarray = reshape((1:24) + (1:24)*i, 2, 3, 4);
+
+%
+% MISC
+%
+eye100x100 = eye(100,100);
+
+%
+% Create files
+%
+varNames = who();
+binFormats = {'-v4';'-v6';'-v7'};
+for varIndex=1:length(varNames)
+ for formatIndex=1:length(binFormats)
+ % Integers and NDarrays not saved in -v4 format
+ if formatIndex>1 | ...
+ (formatIndex==1 & isempty(strfind(varNames{varIndex}, 'int')) ...
+ & isempty(strfind(varNames{varIndex}, 'NDarray')) & isempty(strfind(varNames{varIndex}, 'cell')) & isempty(strfind(varNames{varIndex}, 'struct')) & isempty(strfind(varNames{varIndex}, 'sparse')))
+ if exist([pwd filesep varNames{varIndex} binFormats{formatIndex} ...
+ '.mat']) ~= 2 % If file does not already exist it is created
+ saveCmd = ['save ' pwd filesep varNames{varIndex} binFormats{formatIndex} '.mat ' varNames{varIndex} ' ' binFormats{formatIndex}];
+ eval(saveCmd);
+ else
+ %disp([pwd filesep varNames{varIndex} binFormats{formatIndex} '.mat already exists.'])
+ end
+ end
+ end
+end
+
+% TODO: save all variables in a single file ?
diff --git a/modules/matio/tests/unit_tests/uint16colvector-v6.mat b/modules/matio/tests/unit_tests/uint16colvector-v6.mat
new file mode 100755
index 000000000..ab647595c
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint16colvector-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint16colvector-v7.mat b/modules/matio/tests/unit_tests/uint16colvector-v7.mat
new file mode 100755
index 000000000..f09aad7b8
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint16colvector-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint16matrix-v6.mat b/modules/matio/tests/unit_tests/uint16matrix-v6.mat
new file mode 100755
index 000000000..f16586bf5
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint16matrix-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint16matrix-v7.mat b/modules/matio/tests/unit_tests/uint16matrix-v7.mat
new file mode 100755
index 000000000..7cb7f4c1a
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint16matrix-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint16rowvector-v6.mat b/modules/matio/tests/unit_tests/uint16rowvector-v6.mat
new file mode 100755
index 000000000..db89754b1
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint16rowvector-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint16rowvector-v7.mat b/modules/matio/tests/unit_tests/uint16rowvector-v7.mat
new file mode 100755
index 000000000..2c06ad4c0
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint16rowvector-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint16scalar-v6.mat b/modules/matio/tests/unit_tests/uint16scalar-v6.mat
new file mode 100755
index 000000000..13271c7ea
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint16scalar-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint16scalar-v7.mat b/modules/matio/tests/unit_tests/uint16scalar-v7.mat
new file mode 100755
index 000000000..d65e375cf
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint16scalar-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint32colvector-v6.mat b/modules/matio/tests/unit_tests/uint32colvector-v6.mat
new file mode 100755
index 000000000..323ffc106
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint32colvector-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint32colvector-v7.mat b/modules/matio/tests/unit_tests/uint32colvector-v7.mat
new file mode 100755
index 000000000..3d0da0310
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint32colvector-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint32matrix-v6.mat b/modules/matio/tests/unit_tests/uint32matrix-v6.mat
new file mode 100755
index 000000000..fc56ed0b5
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint32matrix-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint32matrix-v7.mat b/modules/matio/tests/unit_tests/uint32matrix-v7.mat
new file mode 100755
index 000000000..7d401d053
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint32matrix-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint32rowvector-v6.mat b/modules/matio/tests/unit_tests/uint32rowvector-v6.mat
new file mode 100755
index 000000000..7775883ef
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint32rowvector-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint32rowvector-v7.mat b/modules/matio/tests/unit_tests/uint32rowvector-v7.mat
new file mode 100755
index 000000000..1047440a5
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint32rowvector-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint32scalar-v6.mat b/modules/matio/tests/unit_tests/uint32scalar-v6.mat
new file mode 100755
index 000000000..2f0e4c57b
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint32scalar-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint32scalar-v7.mat b/modules/matio/tests/unit_tests/uint32scalar-v7.mat
new file mode 100755
index 000000000..f39dd21c0
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint32scalar-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint8colvector-v6.mat b/modules/matio/tests/unit_tests/uint8colvector-v6.mat
new file mode 100755
index 000000000..f9f5ef240
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint8colvector-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint8colvector-v7.mat b/modules/matio/tests/unit_tests/uint8colvector-v7.mat
new file mode 100755
index 000000000..ced6fb3ec
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint8colvector-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint8matrix-v6.mat b/modules/matio/tests/unit_tests/uint8matrix-v6.mat
new file mode 100755
index 000000000..ec3f7c19d
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint8matrix-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint8matrix-v7.mat b/modules/matio/tests/unit_tests/uint8matrix-v7.mat
new file mode 100755
index 000000000..08745f058
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint8matrix-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint8rowvector-v6.mat b/modules/matio/tests/unit_tests/uint8rowvector-v6.mat
new file mode 100755
index 000000000..32cabffb6
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint8rowvector-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint8rowvector-v7.mat b/modules/matio/tests/unit_tests/uint8rowvector-v7.mat
new file mode 100755
index 000000000..d95c3efb9
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint8rowvector-v7.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint8scalar-v6.mat b/modules/matio/tests/unit_tests/uint8scalar-v6.mat
new file mode 100755
index 000000000..3bfb74f80
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint8scalar-v6.mat
Binary files differ
diff --git a/modules/matio/tests/unit_tests/uint8scalar-v7.mat b/modules/matio/tests/unit_tests/uint8scalar-v7.mat
new file mode 100755
index 000000000..02512305f
--- /dev/null
+++ b/modules/matio/tests/unit_tests/uint8scalar-v7.mat
Binary files differ