PageRenderTime 23ms CodeModel.GetById 9ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 1ms

/test/language/simplify/test_simplify21.e

http://github.com/tybor/Liberty
Specman e | 326 lines | 267 code | 28 blank | 31 comment | 51 complexity | 11f69fb399fd6daca9732c6f9d445ade MD5 | raw file
  1-- This file is part of SmartEiffel The GNU Eiffel Compiler Tools and Libraries.
  2-- See the Copyright notice at the end of this file.
  3--
  4class TEST_SIMPLIFY21
  5
  6insert
  7   PLATFORM
  8   EIFFELTEST_TOOLS
  9
 10create {}
 11   make
 12
 13feature {}
 14   make
 15      do
 16         -- Testing infix "+":
 17         if -128 + 127  = -1 then
 18            assert(True)
 19         else
 20            c_inline_c("*** WrongCcode #1 in TEST_SIMPLIFY21 ***")
 21         end
 22
 23         if Maximum_integer_8 + Minimum_integer_8 = -1 then
 24            assert(True)
 25         else
 26            c_inline_c("*** WrongCcode #2 in TEST_SIMPLIFY21 ***")
 27         end
 28
 29         if -32768 + 32767 = -1 then
 30            assert(True)
 31         else
 32            c_inline_c("*** WrongCcode #3 in TEST_SIMPLIFY21 ***")
 33         end
 34
 35         if Maximum_integer_16 + Minimum_integer_16 = -1 then
 36            assert(True)
 37         else
 38            c_inline_c("*** WrongCcode #4 in TEST_SIMPLIFY21 ***")
 39         end
 40
 41         if -2147483648 + 2147483647  = -1 then
 42            assert(True)
 43         else
 44            c_inline_c("*** WrongCcode #5 in TEST_SIMPLIFY21 ***")
 45         end
 46
 47         if Maximum_integer_32 + Minimum_integer_32 = -1 then
 48            assert(True)
 49         else
 50            c_inline_c("*** WrongCcode #6 in TEST_SIMPLIFY21 ***")
 51         end
 52
 53         if 9223372036854775807 + Minimum_integer_64 = -1 then
 54            assert(True)
 55         else
 56            c_inline_c("*** WrongCcode #7 in TEST_SIMPLIFY21 ***")
 57         end
 58
 59         if Maximum_integer_64 + Minimum_integer_64 = -1 then
 60            assert(True)
 61         else
 62            c_inline_c("*** WrongCcode #8 in TEST_SIMPLIFY21 ***")
 63         end
 64
 65         -- Testing infix "-":
 66         if 127 - 127 - 127 - 1 = -128 then
 67            assert(True)
 68         else
 69            c_inline_c("*** WrongCcode #9 in TEST_SIMPLIFY21 ***")
 70         end
 71
 72         if Maximum_integer_8 - Maximum_integer_8 = 0 then
 73            assert(True)
 74         else
 75            c_inline_c("*** WrongCcode #10 in TEST_SIMPLIFY21 ***")
 76         end
 77
 78         if 32767 - 32767 - 32767 = - 32767  then
 79            assert(True)
 80         else
 81            c_inline_c("*** WrongCcode #11 in TEST_SIMPLIFY21 ***")
 82         end
 83
 84         if Maximum_integer_16 - Maximum_integer_16 = 0 then
 85            assert(True)
 86         else
 87            c_inline_c("*** WrongCcode #12 in TEST_SIMPLIFY21 ***")
 88         end
 89
 90         if 2147483647 - 2147483647 - 2147483647 = - 2147483647 then
 91            assert(True)
 92         else
 93            c_inline_c("*** WrongCcode #13 in TEST_SIMPLIFY21 ***")
 94         end
 95
 96         if Maximum_integer_32 - Maximum_integer_32 = 0 then
 97            assert(True)
 98         else
 99            c_inline_c("*** WrongCcode #14 in TEST_SIMPLIFY21 ***")
100         end
101
102         if 9223372036854775807 - 9223372036854775807 - 9223372036854775807 = - 9223372036854775807 then
103            assert(True)
104         else
105            c_inline_c("*** WrongCcode #15 in TEST_SIMPLIFY21 ***")
106         end
107
108         if Maximum_integer_64 - Maximum_integer_64 = 0 then
109            assert(True)
110         else
111            c_inline_c("*** WrongCcode #16 in TEST_SIMPLIFY21 ***")
112         end
113
114         -- Testing infix "*":
115         if 1 * Minimum_integer_8 = -128 then
116            assert(True)
117         else
118            c_inline_c("*** WrongCcode #17 in TEST_SIMPLIFY21 ***")
119         end
120
121         if {INTEGER_16 2} * Minimum_integer_8 = -256 then
122            assert(True)
123         else
124            c_inline_c("*** WrongCcode #18 in TEST_SIMPLIFY21 ***")
125         end
126
127         if {INTEGER_32 2} * Maximum_integer_16 = 65534 then
128            assert(True)
129         else
130            c_inline_c("*** WrongCcode #19 in TEST_SIMPLIFY21 ***")
131         end
132
133         if {INTEGER_64 2} * Maximum_integer_16 * Maximum_integer_16 = 2147352578 then
134            assert(True)
135         else
136            c_inline_c("*** WrongCcode #20 in TEST_SIMPLIFY21 ***")
137         end
138
139         -- Testing {INTEGER_*}.to_character:
140         if 32.to_character = ' ' then
141            assert(True)
142         else
143            c_inline_c("*** WrongCcode #20 in TEST_SIMPLIFY21 ***")
144         end
145
146         -- Testing {INTEGER_*}.bit_shift_right:
147         if 2.bit_shift_right(1) = 1 then
148            assert(True)
149         else
150            c_inline_c("*** WrongCcode #21 in TEST_SIMPLIFY21 ***")
151         end
152         if 64.bit_shift_right(6) = 1 then
153            assert(True)
154         else
155            c_inline_c("*** WrongCcode #22 in TEST_SIMPLIFY21 ***")
156         end
157         if {INTEGER_16 2}.bit_shift_right(1) = 1 then
158            assert(True)
159         else
160            c_inline_c("*** WrongCcode #23 in TEST_SIMPLIFY21 ***")
161         end
162         if 16384.bit_shift_right(14) = 1 then
163            assert(True)
164         else
165            c_inline_c("*** WrongCcode #24 in TEST_SIMPLIFY21 ***")
166         end
167         if {INTEGER_32 2}.bit_shift_right(1) = 1 then
168            assert(True)
169         else
170            c_inline_c("*** WrongCcode #25 in TEST_SIMPLIFY21 ***")
171         end
172         if 1073741824.bit_shift_right(30) = 1 then
173            assert(True)
174         else
175            c_inline_c("*** WrongCcode #26 in TEST_SIMPLIFY21 ***")
176         end
177         if {INTEGER_64 2}.bit_shift_right(1) = 1 then
178            assert(True)
179         else
180            c_inline_c("*** WrongCcode #27 in TEST_SIMPLIFY21 ***")
181         end
182         if 4611686018427387904.bit_shift_right(62) = 1 then
183            assert(True)
184         else
185            c_inline_c("*** WrongCcode #28 in TEST_SIMPLIFY21 ***")
186         end
187
188         -- Testing {INTEGER_*}.bit_not:
189         if 0.bit_not = -1 then
190            assert(True)
191         else
192            c_inline_c("*** WrongCcode #29 in TEST_SIMPLIFY21 ***")
193         end
194         if {INTEGER_16 0}.bit_not = {INTEGER_16 -1} then
195            assert(True)
196         else
197            c_inline_c("*** WrongCcode #30 in TEST_SIMPLIFY21 ***")
198         end
199         if {INTEGER_32 0}.bit_not = {INTEGER_32 -1} then
200            assert(True)
201         else
202            c_inline_c("*** WrongCcode #31 in TEST_SIMPLIFY21 ***")
203         end
204
205         if {INTEGER_64 0}.bit_not = {INTEGER_64 -1} then
206            assert(True)
207         else
208            c_inline_c("*** WrongCcode #32 in TEST_SIMPLIFY21 ***")
209         end
210         -- Testing {INTEGER_*}.bit_and:
211         if 1.bit_and(-1) = 1 then
212            assert(True)
213         else
214            c_inline_c("*** WrongCcode #33 in TEST_SIMPLIFY21 ***")
215         end
216         if 193.bit_and(64) = 64 then
217            assert(True)
218         else
219            c_inline_c("*** WrongCcode #34 in TEST_SIMPLIFY21 ***")
220         end
221         if 2147483647.bit_and(-1) = 2147483647 then
222            assert(True)
223         else
224            c_inline_c("*** WrongCcode #35 in TEST_SIMPLIFY21 ***")
225         end
226         if Minimum_integer_64.bit_and(-1) = Minimum_integer_64 then
227            assert(True)
228         else
229            c_inline_c("*** WrongCcode #36 in TEST_SIMPLIFY21 ***")
230         end
231         -- Testing {INTEGER_*}.bit_or:
232         if 1.bit_or(64) = 65 then
233            assert(True)
234         else
235            c_inline_c("*** WrongCcode #37 in TEST_SIMPLIFY21 ***")
236         end
237         if 128.bit_or(1) = 129 then
238            assert(True)
239         else
240            c_inline_c("*** WrongCcode #38 in TEST_SIMPLIFY21 ***")
241         end
242         if 32768.bit_or(1) = 32769 then
243            assert(True)
244         else
245            c_inline_c("*** WrongCcode #39 in TEST_SIMPLIFY21 ***")
246         end
247         if Maximum_integer_64.bit_or(Minimum_integer_64) = -1 then
248            assert(True)
249         else
250            c_inline_c("*** WrongCcode #40 in TEST_SIMPLIFY21 ***")
251         end
252         if Maximum_integer_32.bit_or(Minimum_integer_32) = -1 then
253            assert(True)
254         else
255            c_inline_c("*** WrongCcode #41 in TEST_SIMPLIFY21 ***")
256         end
257         if Maximum_integer_16.bit_or(Minimum_integer_16) = -1 then
258            assert(True)
259         else
260            c_inline_c("*** WrongCcode #42 in TEST_SIMPLIFY21 ***")
261         end
262         -- Testing {INTEGER_*}.bit_xor:
263         if Maximum_integer_8.bit_xor(Minimum_integer_8) = -1 then
264            assert(True)
265         else
266            c_inline_c("*** WrongCcode #43 in TEST_SIMPLIFY21 ***")
267         end
268         if Maximum_integer_16.bit_xor(Minimum_integer_16) = -1 then
269            assert(True)
270         else
271            c_inline_c("*** WrongCcode #44 in TEST_SIMPLIFY21 ***")
272         end
273         if Maximum_integer_32.bit_xor(Minimum_integer_32) = -1 then
274            assert(True)
275         else
276            c_inline_c("*** WrongCcode #45 in TEST_SIMPLIFY21 ***")
277         end
278         if Maximum_integer_64.bit_xor(Minimum_integer_64) = -1 then
279            assert(True)
280         else
281            c_inline_c("*** WrongCcode #46 in TEST_SIMPLIFY21 ***")
282         end
283         if 128.bit_xor(64) = 192 then
284            assert(True)
285         else
286            c_inline_c("*** WrongCcode #47 in TEST_SIMPLIFY21 ***")
287         end
288         -- Testing {INTEGER_*}.#-:
289         if #- 1 = -1 then
290            assert(True)
291         else
292            c_inline_c("*** WrongCcode #48 in TEST_SIMPLIFY21 ***")
293         end
294         if #- 128 = -128 then
295            assert(True)
296         else
297            c_inline_c("*** WrongCcode #49 in TEST_SIMPLIFY21 ***")
298         end
299         if #- Minimum_integer_64 = Minimum_integer_64 then
300            assert(True)
301         else
302            c_inline_c("*** WrongCcode #50 in TEST_SIMPLIFY21 ***")
303         end
304
305         assert(assert_counter.item = 51)
306      end
307
308end -- class TEST_SIMPLIFY21
309--
310-- ------------------------------------------------------------------------------------------------------------------------------
311-- Copyright notice below. Please read.
312--
313-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
314-- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
315-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
316-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
317-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
318-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
319--
320-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
321-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
322--
323-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
324--
325-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
326-- ------------------------------------------------------------------------------------------------------------------------------