CLI SHELL MODE only test
[scilab.git] / scilab / modules / hdf5 / tests / unit_tests / loadhdf5data_v1.dia.ref
1 // =============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2011 - DIGITEO - Sylvestre LEDRU
4 //
5 //  This file is distributed under the same license as the Scilab package.
6 // =============================================================================
7 // <-- CLI SHELL MODE -->
8 // Load previously saved data (check backward compatibility)
9 ///// Double
10 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricedoublescalar_v1.sod");
11 assert_checkequal(ascalar,42);
12 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricedouble_v1.sod");
13 assert_checkequal(a,[2,3;4,5]);
14 ///// Double complex
15 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricedoublecomplex_v1.sod");
16 assert_checkequal(b,[2+%i,3+%i*2;4+%i*%pi,5]);
17 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricedoublecomplexscalar_v1.sod");
18 assert_checkequal(bscalar,42+%i);
19 ///// String
20 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricestring_v1.sod");
21 assert_checkequal(c,["my matrix","of strings";"is","saved in Scilab data format"]);
22 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/matricestringscalar_v1.sod");
23 assert_checkequal(cscalar,["my single string"]);
24 // Polynomials
25 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/polynomials_v1.sod");
26 p_reference=poly([1 2],'s') ;
27 assert_checkequal(p,p_reference);
28 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/polynomialscoef_v1.sod");
29 q_reference=poly([1 42],'s','c');
30 assert_checkequal(q,q_reference);
31 // Boolean matrices
32 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/booleanscalar_v1.sod");
33 assert_checkequal(bm,%t);
34 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/booleanmatrix_v1.sod");
35 assert_checkequal(bmm,[%t,%f; %f, %t]);
36 // Sparse
37 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/sparsematrix_v1.sod");
38 assert_checkequal(sp,sparse([1,2;4,5;3,10],[1,2,3]));
39 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/emptysparse_v1.sod");
40 assert_checkequal(emptysparse,sparse([]));
41 // boolean sparse
42 dense=[%F, %F, %T, %F, %F
43 %T, %F, %F, %F, %F
44 %F, %F, %F, %F, %F
45 %F, %F, %F, %F, %T];
46 sp_reference=sparse(dense);
47 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/booleansparse_v1.sod");
48 assert_checkequal(sp,sp_reference);
49 // List
50 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/list_v1.sod");
51 assert_checkequal(ls,list(2,%i,'f',ones(3,3)));
52 ls(2) =  list( %t, [32,42]); // alter ls to add the list
53 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/listnested_v1.sod");
54 assert_checkequal(lsnested,ls);
55 // tlist
56 lst_reference  =  tlist(['random numbers';'Name';'Example'], 'Uniform',ones(1,2, 3));
57 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/tlist_v1.sod");
58 assert_checkequal(lst,lst_reference);
59 // mlist
60 M_ref=mlist(['V','name','value'],['a','b';'c' 'd'],[1 2; 3 4]);
61 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/mlist_v1.sod");
62 // Commented because of bug 9531
63 //assert_checkequal(M_ref,M);
64 // hypermatrices
65 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/hypermatrix_v1.sod");
66 assert_checkequal(HM,hypermat([2 3 2 2],1:24));
67 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/hypermatrixcomplex_v1.sod");
68 HMC_reference(1,1,1,1:2)=[1+%i 2*2*%i];
69 assert_checkequal(HMC,HMC_reference);
70 // int
71 emptyint8matrix_ref = int8([]);
72 int8scalar_ref = int8(1);
73 int8rowvector_ref = int8([1 -4 7]);
74 int8colvector_ref = int8([1;-4;7]);
75 int8matrix_ref = int8([1 -4 7;-9 6 -3]);
76 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/int8_v1.sod");
77 assert_checkequal(emptyint8matrix, emptyint8matrix_ref);
78 assert_checkequal(int8scalar, int8scalar_ref);
79 assert_checkequal(int8rowvector, int8rowvector_ref);
80 assert_checkequal(int8colvector, int8colvector_ref);
81 assert_checkequal(int8matrix, int8matrix_ref);
82 emptyint16matrix_ref = int16([]);
83 int16scalar_ref = int16(1);
84 int16rowvector_ref = int16([1 -4 7]);
85 int16colvector_ref = int16([1;-4;7]);
86 int16matrix_ref = int16([1 -4 7;-9 6 -3]);
87 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/int16_v1.sod");
88 assert_checkequal(emptyint16matrix, emptyint16matrix_ref);
89 assert_checkequal(int16scalar, int16scalar_ref);
90 assert_checkequal(int16rowvector, int16rowvector_ref);
91 assert_checkequal(int16colvector, int16colvector_ref);
92 assert_checkequal(int16matrix, int16matrix_ref);
93 emptyint32matrix_ref = int32([]);
94 int32scalar_ref = int32(1);
95 int32rowvector_ref = int32([1 -4 7]);
96 int32colvector_ref = int32([1;-4;7]);
97 int32matrix_ref = int32([1 -4 7;-9 6 -3]);
98 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/int32_v1.sod");
99 assert_checkequal(emptyint32matrix, emptyint32matrix_ref);
100 assert_checkequal(int32scalar, int32scalar_ref);
101 assert_checkequal(int32rowvector, int32rowvector_ref);
102 assert_checkequal(int32colvector, int32colvector_ref);
103 assert_checkequal(int32matrix, int32matrix_ref);
104 emptyuint8matrix_ref = uint8([]);
105 uint8scalar_ref = uint8(1);
106 uint8rowvector_ref = uint8([1 4 7]);
107 uint8colvector_ref = uint8([1;4;7]);
108 uint8matrix_ref = uint8([1 4 7;9 6 3]);
109 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/uint8_v1.sod");
110 assert_checkequal(emptyuint8matrix, emptyuint8matrix_ref);
111 assert_checkequal(uint8scalar, uint8scalar_ref);
112 assert_checkequal(uint8rowvector, uint8rowvector_ref);
113 assert_checkequal(uint8colvector, uint8colvector_ref);
114 assert_checkequal(uint8matrix, uint8matrix_ref);
115 emptyuint16matrix_ref = uint16([]);
116 uint16scalar_ref = uint16(1);
117 uint16rowvector_ref = uint16([1 4 7]);
118 uint16colvector_ref = uint16([1;4;7]);
119 uint16matrix_ref = uint16([1 4 7;9 6 3]);
120 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/uint16_v1.sod");
121 assert_checkequal(emptyuint16matrix, emptyuint16matrix_ref);
122 assert_checkequal(uint16scalar, uint16scalar_ref);
123 assert_checkequal(uint16rowvector, uint16rowvector_ref);
124 assert_checkequal(uint16colvector, uint16colvector_ref);
125 assert_checkequal(uint16matrix, uint16matrix_ref);
126 emptyuint32matrix_ref = uint32([]);
127 uint32scalar_ref = uint32(1);
128 uint32rowvector_ref = uint32([1 4 7]);
129 uint32colvector_ref = uint32([1;4;7]);
130 uint32matrix_ref = uint32([1 4 7;9 6 3]);
131 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/uint32_v1.sod");
132 assert_checkequal(emptyuint32matrix, emptyuint32matrix_ref);
133 assert_checkequal(uint32scalar, uint32scalar_ref);
134 assert_checkequal(uint32rowvector, uint32rowvector_ref);
135 assert_checkequal(uint32colvector, uint32colvector_ref);
136 assert_checkequal(uint32matrix, uint32matrix_ref);
137 // undefined
138 undefinedelement_ref=list(2,%i,'f',ones(3,3));
139 undefinedelement_ref(6)="toto";
140 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/undefinedelement_v1.sod");
141 assert_checkequal(undefinedelement, undefinedelement_ref);
142 // void
143 voidelement_ref=list(1,,3);
144 import_from_hdf5(SCI+"/modules/hdf5/tests/sample_scilab_data/voidelement_v1.sod");
145 // Commented because of bug 9529
146 //assert_checkequal(voidelement, voidelement_ref);