9d89abdc7356b16dc7274d4c5203daedeb2b438f
[scilab.git] / scilab / modules / ast / tests / unit_tests / and.dia.ref
1 // ============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2014 - Scilab Enterprises - Antoine ELIAS
4 //
5 //  This file is distributed under the same license as the Scilab package.
6 // ============================================================================
7 //
8 // <-- CLI SHELL MODE -->
9 empty = [];
10 r = 2;
11 R = [1,2;3,4];
12 R3(:,:,1) = R;
13 R3(:,:,2) = R';
14 c = 1 + 2*%i;
15 C = [1+2*%i,2+4*%i;3+6*%i,4+8*%i];
16 C3(:,:,1) = C;
17 C3(:,:,2) = C';
18 e = eye();
19 ec = (5+%i) * eye();
20 p = 1 + %s - %s**2;
21 pc = 1 + %s - %s**2 + ( 2 - 3 * %s + 4 * %s**2 ) * %i;
22 P = [2*p, -3*p;4*p,-5*p];
23 PC = [2*pc, -3*pc;4*pc,-5*pc];
24 SP = sparse([1,2;4,5;3,10],[1,2,3]);
25 SPC = sparse([1,2;4,5;3,10],[1,2,3]) * ( 1 + 4*%i);
26 SPB = sparse([1,2;2,1],[%t;%t],[2,2]);
27 i8 = int8(-8);
28 ui8 = uint8(8);
29 I8 = int8([-8 -16 ; -24 -32]);
30 UI8 = uint8([8 16 ; 24 32]);
31 I16 = int16([-16 -32 ; -48 -64]);
32 UI16 = uint16([16 32 ; 48 64]);
33 i16 = int16(-16);
34 ui16 = uint16(16);
35 i32 = int32(-32);
36 ui32 = uint32(32);
37 I32 = int32([-32 -64 ; -96 -128]);
38 UI32 = uint32([32 64 ; 96 128]);
39 str = "string";
40 STR = ["string1" "string2";"string3" "string4"];
41 b = %f;
42 B = [%t %f;%f %t];
43 assert_checkequal(empty & empty, []);
44 assert_checkequal(empty & r, []);
45 assert_checkequal(empty & R, []);
46 assert_checkequal(empty & e, []);
47 assert_checkequal(empty & b, %f);
48 assert_checkequal(empty & B, [%t,%f;%f,%t]);
49 assert_checkequal(r & empty, []);
50 assert_checkequal(r & r, %t);
51 assert_checkequal(r & R, [%t,%t;%t,%t]);
52 assert_checkequal(r & e, %t);
53 assert_checkequal(r & b, %f);
54 assert_checkequal(r & B, [%t,%f;%f,%t]);
55 assert_checkequal(R & empty, []);
56 assert_checkequal(R & r, [%t,%t;%t,%t]);
57 assert_checkequal(R & R, [%t,%t;%t,%t]);
58 assert_checkequal(R & e, [%t,%t;%t,%t]);
59 assert_checkequal(R & b, [%f,%f;%f,%f]);
60 assert_checkequal(R & B, [%t,%f;%f,%t]);
61 assert_checkequal(e & empty, []);
62 assert_checkequal(e & r, %t);
63 assert_checkequal(e & R, [%t,%t;%t,%t]);
64 assert_checkequal(e & b, %f);
65 assert_checkequal(e & B, [%t,%f;%f,%t]);
66 assert_checkequal(b & empty, %f);
67 assert_checkequal(b & r, %f);
68 assert_checkequal(b & R, [%f,%f;%f,%f]);
69 assert_checkequal(b & e, %f);
70 assert_checkequal(b & b, %f);
71 assert_checkequal(b & B, [%f,%f;%f,%f]);
72 assert_checkequal(b & SPB, sparse([1,1], [%f], [2, 2]));
73 assert_checkequal(B & empty, [%t,%f;%f,%t]);
74 assert_checkequal(B & r, [%t,%f;%f,%t]);
75 assert_checkequal(B & R, [%t,%f;%f,%t]);
76 assert_checkequal(B & e, [%t,%f;%f,%t]);
77 assert_checkequal(B & b, [%f,%f;%f,%f]);
78 assert_checkequal(B & B, [%t,%f;%f,%t]);
79 assert_checkequal(B & SPB, sparse([1,1], [%f], [2, 2]));
80 assert_checkequal(SPB & b, sparse([1,1], [%f], [2, 2]));
81 assert_checkequal(SPB & B, sparse([1,1], [%f], [2, 2]));
82 assert_checkequal(SPB & SPB, sparse([1,2;2,1],[%t;%t],[2,2]));
83 assert_checkequal(i8 & i8, int8(-8));
84 assert_checkequal(i8 & I8, int8([-8,-16;-24,-32]));
85 assert_checkequal(i8 & ui8, uint8(8));
86 assert_checkequal(i8 & UI8, uint8([8,16;24,32]));
87 assert_checkequal(i8 & i16, int16(-16));
88 assert_checkequal(i8 & I16, int16([-16,-32;-48,-64]));
89 assert_checkequal(i8 & ui16, uint16(16));
90 assert_checkequal(i8 & UI16, uint16([16,32;48,64]));
91 assert_checkequal(i8 & i32, int32(-32));
92 assert_checkequal(i8 & I32, int32([-32,-64;-96,-128]));
93 assert_checkequal(i8 & ui32, uint32(32));
94 assert_checkequal(i8 & UI32, uint32([32,64;96,128]));
95 assert_checkequal(I8 & i8, int8([-8,-16;-24,-32]));
96 assert_checkequal(I8 & I8, int8([-8,-16;-24,-32]));
97 assert_checkequal(I8 & ui8, uint8([8,0;8,0]));
98 assert_checkequal(I8 & UI8, uint8([8,16;8,32]));
99 assert_checkequal(I8 & i16, int16([-16,-16;-32,-32]));
100 assert_checkequal(I8 & I16, int16([-16,-32;-64,-64]));
101 assert_checkequal(I8 & ui16, uint16([16,16;0,0]));
102 assert_checkequal(I8 & UI16, uint16([16,32;32,64]));
103 assert_checkequal(I8 & i32, int32([-32,-32;-32,-32]));
104 assert_checkequal(I8 & I32, int32([-32,-64;-96,-128]));
105 assert_checkequal(I8 & ui32, uint32([32,32;32,32]));
106 assert_checkequal(I8 & UI32, uint32([32,64;96,128]));
107 assert_checkequal(ui8 & i8, uint8(8));
108 assert_checkequal(ui8 & I8, uint8([8,0;8,0]));
109 assert_checkequal(ui8 & ui8, uint8(8));
110 assert_checkequal(ui8 & UI8, uint8([8,0;8,0]));
111 assert_checkequal(ui8 & i16, uint16(0));
112 assert_checkequal(ui8 & I16, uint16([0,0;0,0]));
113 assert_checkequal(ui8 & ui16, uint16(0));
114 assert_checkequal(ui8 & UI16, uint16([0,0;0,0]));
115 assert_checkequal(ui8 & i32, uint32(0));
116 assert_checkequal(ui8 & I32, uint32([0,0;0,0]));
117 assert_checkequal(ui8 & ui32, uint32(0));
118 assert_checkequal(ui8 & UI32, uint32([0,0;0,0]));
119 assert_checkequal(UI8 & i8, uint8([8,16;24,32]));
120 assert_checkequal(UI8 & I8, uint8([8,16;8,32]));
121 assert_checkequal(UI8 & ui8, uint8([8,0;8,0]));
122 assert_checkequal(UI8 & UI8, uint8([8,16;24,32]));
123 assert_checkequal(UI8 & i16, uint16([0,16;16,32]));
124 assert_checkequal(UI8 & I16, uint16([0,0;16,0]));
125 assert_checkequal(UI8 & ui16, uint16([0,16;16,0]));
126 assert_checkequal(UI8 & UI16, uint16([0,0;16,0]));
127 assert_checkequal(UI8 & i32, uint32([0,0;0,32]));
128 assert_checkequal(UI8 & I32, uint32([0,0;0,0]));
129 assert_checkequal(UI8 & ui32, uint32([0,0;0,32]));
130 assert_checkequal(UI8 & UI32, uint32([0,0;0,0]));
131 assert_checkequal(i16 & i8, int16(-16));
132 assert_checkequal(i16 & I8, int16([-16,-16;-32,-32]));
133 assert_checkequal(i16 & ui8, uint16(0));
134 assert_checkequal(i16 & UI8, uint16([0,16;16,32]));
135 assert_checkequal(i16 & i16, int16(-16));
136 assert_checkequal(i16 & I16, int16([-16,-32;-48,-64]));
137 assert_checkequal(i16 & ui16, uint16(16));
138 assert_checkequal(i16 & UI16, uint16([16,32;48,64]));
139 assert_checkequal(i16 & i32, int32(-32));
140 assert_checkequal(i16 & I32, int32([-32,-64;-96,-128]));
141 assert_checkequal(i16 & ui32, uint32(32));
142 assert_checkequal(i16 & UI32, uint32([32,64;96,128]));
143 assert_checkequal(I16 & i8, int16([-16,-32;-48,-64]));
144 assert_checkequal(I16 & I8, int16([-16,-32;-64,-64]));
145 assert_checkequal(I16 & ui8, uint16([0,0;0,0]));
146 assert_checkequal(I16 & UI8, uint16([0,0;16,0]));
147 assert_checkequal(I16 & i16, int16([-16,-32;-48,-64]));
148 assert_checkequal(I16 & I16, int16([-16,-32;-48,-64]));
149 assert_checkequal(I16 & ui16, uint16([16,0;16,0]));
150 assert_checkequal(I16 & UI16, uint16([16,32;16,64]));
151 assert_checkequal(I16 & i32, int32([-32,-32;-64,-64]));
152 assert_checkequal(I16 & I32, int32([-32,-64;-128,-128]));
153 assert_checkequal(I16 & ui32, uint32([32,32;0,0]));
154 assert_checkequal(I16 & UI32, uint32([32,64;64,128]));
155 assert_checkequal(ui16 & i8, uint16(16));
156 assert_checkequal(ui16 & I8, uint16([16,16;0,0]));
157 assert_checkequal(ui16 & ui8, uint16(0));
158 assert_checkequal(ui16 & UI8, uint16([0,16;16,0]));
159 assert_checkequal(ui16 & i16, uint16(16));
160 assert_checkequal(ui16 & I16, uint16([16,0;16,0]));
161 assert_checkequal(ui16 & ui16, uint16(16));
162 assert_checkequal(ui16 & UI16, uint16([16,0;16,0]));
163 assert_checkequal(ui16 & i32, uint32(0));
164 assert_checkequal(ui16 & I32, uint32([0,0;0,0]));
165 assert_checkequal(ui16 & ui32, uint32(0));
166 assert_checkequal(ui16 & UI32, uint32([0,0;0,0]));
167 assert_checkequal(UI16 & i8, uint16([16,32;48,64]));
168 assert_checkequal(UI16 & I8, uint16([16,32;32,64]));
169 assert_checkequal(UI16 & ui8, uint16([0,0;0,0]));
170 assert_checkequal(UI16 & UI8, uint16([0,0;16,0]));
171 assert_checkequal(UI16 & i16, uint16([16,32;48,64]));
172 assert_checkequal(UI16 & I16, uint16([16,32;16,64]));
173 assert_checkequal(UI16 & ui16, uint16([16,0;16,0]));
174 assert_checkequal(UI16 & UI16, uint16([16,32;48,64]));
175 assert_checkequal(UI16 & i32, uint32([0,32;32,64]));
176 assert_checkequal(UI16 & I32, uint32([0,0;32,0]));
177 assert_checkequal(UI16 & ui32, uint32([0,32;32,0]));
178 assert_checkequal(UI16 & UI32, uint32([0,0;32,0]));
179 assert_checkequal(i32 & i8, int32(-32));
180 assert_checkequal(i32 & I8, int32([-32,-32;-32,-32]));
181 assert_checkequal(i32 & ui8, uint32(0));
182 assert_checkequal(i32 & UI8, uint32([0,0;0,32]));
183 assert_checkequal(i32 & i16, int32(-32));
184 assert_checkequal(i32 & I16, int32([-32,-32;-64,-64]));
185 assert_checkequal(i32 & ui16, uint32(0));
186 assert_checkequal(i32 & UI16, uint32([0,32;32,64]));
187 assert_checkequal(i32 & i32, int32(-32));
188 assert_checkequal(i32 & I32, int32([-32,-64;-96,-128]));
189 assert_checkequal(i32 & ui32, uint32(32));
190 assert_checkequal(i32 & UI32, uint32([32,64;96,128]));
191 assert_checkequal(I32 & i8, int32([-32,-64;-96,-128]));
192 assert_checkequal(I32 & I8, int32([-32,-64;-96,-128]));
193 assert_checkequal(I32 & ui8, uint32([0,0;0,0]));
194 assert_checkequal(I32 & UI8, uint32([0,0;0,0]));
195 assert_checkequal(I32 & i16, int32([-32,-64;-96,-128]));
196 assert_checkequal(I32 & I16, int32([-32,-64;-128,-128]));
197 assert_checkequal(I32 & ui16, uint32([0,0;0,0]));
198 assert_checkequal(I32 & UI16, uint32([0,0;32,0]));
199 assert_checkequal(I32 & i32, int32([-32,-64;-96,-128]));
200 assert_checkequal(I32 & I32, int32([-32,-64;-96,-128]));
201 assert_checkequal(I32 & ui32, uint32([32,0;32,0]));
202 assert_checkequal(I32 & UI32, uint32([32,64;32,128]));
203 assert_checkequal(ui32 & i8, uint32(32));
204 assert_checkequal(ui32 & I8, uint32([32,32;32,32]));
205 assert_checkequal(ui32 & ui8, uint32(0));
206 assert_checkequal(ui32 & UI8, uint32([0,0;0,32]));
207 assert_checkequal(ui32 & i16, uint32(32));
208 assert_checkequal(ui32 & I16, uint32([32,32;0,0]));
209 assert_checkequal(ui32 & ui16, uint32(0));
210 assert_checkequal(ui32 & UI16, uint32([0,32;32,0]));
211 assert_checkequal(ui32 & i32, uint32(32));
212 assert_checkequal(ui32 & I32, uint32([32,0;32,0]));
213 assert_checkequal(ui32 & ui32, uint32(32));
214 assert_checkequal(ui32 & UI32, uint32([32,0;32,0]));
215 assert_checkequal(UI32 & i8, uint32([32,64;96,128]));
216 assert_checkequal(UI32 & I8, uint32([32,64;96,128]));
217 assert_checkequal(UI32 & ui8, uint32([0,0;0,0]));
218 assert_checkequal(UI32 & UI8, uint32([0,0;0,0]));
219 assert_checkequal(UI32 & i16, uint32([32,64;96,128]));
220 assert_checkequal(UI32 & I16, uint32([32,64;64,128]));
221 assert_checkequal(UI32 & ui16, uint32([0,0;0,0]));
222 assert_checkequal(UI32 & UI16, uint32([0,0;32,0]));
223 assert_checkequal(UI32 & i32, uint32([32,64;96,128]));
224 assert_checkequal(UI32 & I32, uint32([32,64;32,128]));
225 assert_checkequal(UI32 & ui32, uint32([32,0;32,0]));
226 assert_checkequal(UI32 & UI32, uint32([32,64;96,128]));