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