PageRenderTime 26ms CodeModel.GetById 16ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 1ms

/test/language/simplify/test_simplify05.e

http://github.com/tybor/Liberty
Specman e | 571 lines | 516 code | 11 blank | 44 comment | 58 complexity | b21e0debef8f0b3bd4ee27ddc48a0821 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_SIMPLIFY05
  5
  6create {}
  7   make
  8
  9feature {ANY}
 10   make
 11      local
 12         bool: BOOLEAN
 13      do
 14         -- The generated code should only contains the following
 15         -- instruction:
 16         check_order(0)
 17         -- --------------------------------------------------------------------
 18         -- inspect statement:
 19         inspect
 20            1
 21         when 1 then
 22            check_order(1)
 23         when 2 then
 24            c_inline_c("#1 in boost_simplify05")
 25         when 3 then
 26            c_inline_c("#2 in boost_simplify05")
 27         end
 28         inspect
 29            2
 30         when 1 then
 31            c_inline_c("#3 in boost_simplify05")
 32         when 2 then
 33            check_order(2)
 34         when 3 then
 35            c_inline_c("#4 in boost_simplify05")
 36         end
 37         inspect
 38            3
 39         when 1 then
 40            c_inline_c("#5 in boost_simplify05")
 41         when 2 then
 42            c_inline_c("#6 in boost_simplify05")
 43         when 3 then
 44            check_order(3)
 45         end
 46         --
 47         inspect
 48            'a'
 49         when 'a' then
 50            check_order(4)
 51         when 'b' then
 52            c_inline_c("#7 in boost_simplify05")
 53         when 'c' then
 54            c_inline_c("#8 in boost_simplify05")
 55         end
 56         inspect
 57            'b'
 58         when 'a' then
 59            c_inline_c("#9 in boost_simplify05")
 60         when 'b' then
 61            check_order(5)
 62         when 'c' then
 63            c_inline_c("#10 in boost_simplify05")
 64         end
 65         inspect
 66            'c'
 67         when 'a' then
 68            c_inline_c("#11 in boost_simplify05")
 69         when 'b' then
 70            c_inline_c("#12 in boost_simplify05")
 71         when 'c' then
 72            check_order(6)
 73         end
 74         --
 75         inspect
 76            4
 77         when 1 then
 78            c_inline_c("#13 in boost_simplify05")
 79         when 2 then
 80            c_inline_c("#14 in boost_simplify05")
 81         when 3 then
 82            c_inline_c("#15 in boost_simplify05")
 83         else
 84            check_order(7)
 85         end
 86         inspect
 87            'd'
 88         when 'a' then
 89            c_inline_c("#16 in boost_simplify05")
 90         when 'b' then
 91            c_inline_c("#17 in boost_simplify05")
 92         when 'c' then
 93            c_inline_c("#18 in boost_simplify05")
 94         else
 95            check_order(8)
 96         end
 97         --
 98         inspect
 99            'd'
100         when 'a' then
101            c_inline_c("#19 in boost_simplify05")
102         when 'b' then
103            c_inline_c("#20 in boost_simplify05")
104         when 'c' then
105            c_inline_c("#21 in boost_simplify05")
106         else
107         end
108         inspect
109            4
110         when 1 then
111            c_inline_c("#22 in boost_simplify05")
112         when 2 then
113            c_inline_c("#23 in boost_simplify05")
114         when 3 then
115            c_inline_c("#24 in boost_simplify05")
116         else
117         end
118         --
119         inspect
120            1
121         when 1 .. 2 then
122            check_order(9)
123         when 3 .. 4 then
124            c_inline_c("#25 in boost_simplify05")
125         when 5 .. 6 then
126            c_inline_c("#26 in boost_simplify05")
127         end
128         inspect
129            'a'
130         when 'a' .. 'b' then
131            check_order(10)
132         when 'c' .. 'd' then
133            c_inline_c("#27 in boost_simplify05")
134         when 'e' .. 'f' then
135            c_inline_c("#28 in boost_simplify05")
136         end
137         --
138         inspect
139            7
140         when 1 .. 2 then
141            c_inline_c("#29 in boost_simplify05")
142         when 3 .. 4 then
143            c_inline_c("#30 in boost_simplify05")
144         when 5 .. 6 then
145            c_inline_c("#31 in boost_simplify05")
146         else
147            check_order(11)
148         end
149         inspect
150            'g'
151         when 'a' .. 'b' then
152            c_inline_c("#32 in boost_simplify05")
153         when 'c' .. 'd' then
154            c_inline_c("#33 in boost_simplify05")
155         when 'e' .. 'f' then
156            c_inline_c("#34 in boost_simplify05")
157         else
158            check_order(12)
159         end
160         --
161         inspect
162            'g'
163         when 'a' .. 'b' then
164            c_inline_c("#35 in boost_simplify05")
165         when 'c' .. 'd' then
166            c_inline_c("#36 in boost_simplify05")
167         when 'e' .. 'f' then
168            c_inline_c("#37 in boost_simplify05")
169         else
170         end
171         inspect
172            7
173         when 1 .. 2 then
174            c_inline_c("#38 in boost_simplify05")
175         when 3 .. 4 then
176            c_inline_c("#39 in boost_simplify05")
177         when 5 .. 6 then
178            c_inline_c("#40 in boost_simplify05")
179         else
180         end
181         -- --------------------------------------------------------------------
182         -- if-then-else  statement:
183         if True then
184            check_order(13)
185         end
186         if True then
187         end
188         if False then
189            c_inline_c("#41 in boost_simplify05")
190         end
191         --
192         if True then
193            check_order(14)
194         else
195            c_inline_c("#42 in boost_simplify05")
196         end
197         if True then
198         else
199            c_inline_c("#43 in boost_simplify05")
200         end
201         if False then
202            c_inline_c("#44 in boost_simplify05")
203         else
204            check_order(15)
205         end
206         if False then
207            c_inline_c("#45 in boost_simplify05")
208         end
209         --
210         if True then
211            check_order(16)
212         elseif True then
213            c_inline_c("#46 in boost_simplify05")
214         else
215            c_inline_c("#47 in boost_simplify05")
216         end
217         if True then
218            check_order(17)
219         elseif False then
220            c_inline_c("#48 in boost_simplify05")
221         else
222            c_inline_c("#48 in boost_simplify05")
223         end
224         if False then
225            c_inline_c("#50 in boost_simplify05")
226         elseif True then
227            check_order(18)
228         else
229            c_inline_c("#51 in boost_simplify05")
230         end
231         if False then
232            c_inline_c("#52 in boost_simplify05")
233         elseif True then
234         else
235            c_inline_c("#53 in boost_simplify05")
236         end
237         if False then
238            c_inline_c("#54 in boost_simplify05")
239         elseif False then
240            c_inline_c("#55 in boost_simplify05")
241         else
242            check_order(19)
243         end
244         if False then
245            c_inline_c("#56 in boost_simplify05")
246         elseif False then
247            c_inline_c("#57 in boost_simplify05")
248         end
249         --
250         if True then
251            check_order(20)
252         elseif True then
253            c_inline_c("#58 in boost_simplify05")
254         elseif True then
255            c_inline_c("#59 in boost_simplify05")
256         else
257            c_inline_c("#60 in boost_simplify05")
258         end
259         if True then
260            check_order(21)
261         elseif False then
262            c_inline_c("#61 in boost_simplify05")
263         elseif True then
264            c_inline_c("#62 in boost_simplify05")
265         else
266            c_inline_c("#63 in boost_simplify05")
267         end
268         if True then
269            check_order(22)
270         elseif True then
271            c_inline_c("#64 in boost_simplify05")
272         elseif False then
273            c_inline_c("#65 in boost_simplify05")
274         else
275            c_inline_c("#66 in boost_simplify05")
276         end
277         if True then
278            check_order(23)
279         elseif False then
280            c_inline_c("#67 in boost_simplify05")
281         elseif False then
282            c_inline_c("#68 in boost_simplify05")
283         else
284            c_inline_c("#69 in boost_simplify05")
285         end
286         if True then
287            check_order(24)
288         elseif False then
289            c_inline_c("#70 in boost_simplify05")
290         elseif True then
291            c_inline_c("#71 in boost_simplify05")
292         else
293            c_inline_c("#72 in boost_simplify05")
294         end
295         if False then
296            c_inline_c("#73 in boost_simplify05")
297         elseif True then
298            check_order(25)
299         elseif True then
300            c_inline_c("#74 in boost_simplify05")
301         else
302            c_inline_c("#75 in boost_simplify05")
303         end
304         if False then
305            c_inline_c("#76 in boost_simplify05")
306         elseif True then
307            check_order(26)
308         elseif False then
309            c_inline_c("#77 in boost_simplify05")
310         else
311            c_inline_c("#78 in boost_simplify05")
312         end
313         if False then
314            c_inline_c("#79 in boost_simplify05")
315         elseif False then
316            c_inline_c("#80 in boost_simplify05")
317         elseif True then
318            check_order(27)
319         else
320            c_inline_c("#81 in boost_simplify05")
321         end
322         if False then
323            c_inline_c("#82 in boost_simplify05")
324         elseif False then
325            c_inline_c("#83 in boost_simplify05")
326         elseif True then
327         else
328            c_inline_c("#84 in boost_simplify05")
329         end
330         if False then
331            c_inline_c("#85 in boost_simplify05")
332         elseif False then
333            c_inline_c("#86 in boost_simplify05")
334         elseif False then
335            c_inline_c("#87 in boost_simplify05")
336         else
337            check_order(28)
338         end
339         if False then
340            c_inline_c("#88 in boost_simplify05")
341         elseif False then
342            c_inline_c("#89 in boost_simplify05")
343         elseif False then
344            c_inline_c("#90 in boost_simplify05")
345         end
346         --
347         if is_order(bool, 29) then
348            never_here
349         end
350         if is_order(bool, 30) then
351            never_here
352         else
353            check_order(31)
354         end
355         --
356         if is_order(bool, 32) then
357            never_here
358         elseif is_order(bool, 33) then
359            never_here
360         end
361         if is_order(bool, 34) then
362            never_here
363         elseif is_order(bool, 35) then
364            never_here
365         else
366            check_order(36)
367         end
368         if True then
369            check_order(37)
370         elseif is_order(bool, 37) then
371            c_inline_c("#91 in boost_simplify05")
372         else
373            c_inline_c("#92 in boost_simplify05")
374         end
375         if False then
376            c_inline_c("#93 in boost_simplify05")
377         elseif is_order(bool, 38) then
378            never_here
379         else
380            check_order(39)
381         end
382         if False then
383            c_inline_c("#94 in boost_simplify05")
384         elseif is_order(bool, 40) then
385            never_here
386         elseif is_order(bool, 41) then
387            never_here
388         else
389            check_order(42)
390         end
391         if is_order(bool, 43) then
392            never_here
393         elseif False then
394            c_inline_c("#95 in boost_simplify05")
395         elseif True then
396            check_order(44)
397         end
398         if 0.is_default then
399            check_order(45)
400         else
401            c_inline_c("#96 in boost_simplify05")
402         end
403         if False.is_default then
404            check_order(46)
405         else
406            c_inline_c("#97 in boost_simplify05")
407         end
408         if 0.0.is_default then
409            check_order(47)
410         else
411            c_inline_c("#98 in boost_simplify05")
412         end
413         if '%U'.is_default then
414            check_order(48)
415         else
416            c_inline_c("#99 in boost_simplify05")
417         end
418         if Current.to_pointer.is_default then
419            never_here
420         end
421         if True = True then
422            check_order(49)
423         end
424         if (True and True) = True then
425            check_order(50)
426         end
427         if True = (True and True) then
428            check_order(51)
429         end
430         if True /= False then
431            check_order(52)
432         else
433            c_inline_c("#100 in boost_simplify05")
434         end
435         if False /= True then
436            check_order(53)
437         else
438            c_inline_c("#101 in boost_simplify05")
439         end
440         if a_integer_3 = 3 then
441            check_order(54)
442         end
443         if a_void_1 = Void then
444            check_order(55)
445         end
446         if a_void_2 = Void then
447            check_order(56)
448         end
449         if Current.is_default then
450            never_here
451         else
452            check_order(57)
453         end
454         -- Testing implies:
455         if True implies True then
456            check_order(58)
457         else
458            c_inline_c("#102 in boost_simplify05")
459         end
460         if True implies False then
461            c_inline_c("#103 in boost_simplify05")
462         else
463            check_order(59)
464         end
465         if False implies True then
466            check_order(60)
467         else
468            c_inline_c("#104 in boost_simplify05")
469         end
470         if False implies False then
471            check_order(61)
472         else
473            c_inline_c("#105 in boost_simplify05")
474         end
475         if False implies no_evaluation then
476            check_order(62)
477         else
478            c_inline_c("#106 in boost_simplify05")
479         end
480         if False implies no_evaluation then
481            check_order(63)
482         else
483            c_inline_c("#107 in boost_simplify05")
484         end
485         if 1.same_dynamic_type(2) then
486            check_order(64)
487         end
488         if 1.same_dynamic_type(2) then
489            check_order(65)
490         end
491         if same_dynamic_type(Current) then
492            check_order(66)
493         end
494         if same_dynamic_type(Current) then
495            check_order(67)
496         end
497         -- Last one:
498         check_order(68)
499      end
500
501   no_evaluation: BOOLEAN
502         -- Should never be called.
503      do
504         -- To make this function not computable.
505         if previous_n = 10 then
506            Result := True
507         end
508         sedb_breakpoint
509         std_output.put_string("TEST_SIMPLIFY05: ERROR (no_evaluation).%N")
510      end
511
512   a_integer_3: INTEGER
513      do
514         Result := 1 + 2
515      end
516
517   a_void_1: ANY
518      do
519         Result := Void
520      end
521
522   a_void_2: ANY
523      do
524      end
525
526   previous_n: INTEGER
527         -- To check that `check_order' call are in the original
528         -- order.
529
530   check_order (n: INTEGER)
531      do
532         if n /= previous_n then
533            sedb_breakpoint
534            std_output.put_string("TEST_SIMPLIFY_2: ERROR Test # ")
535            std_output.put_integer(previous_n)
536            std_output.put_string("%N")
537         end
538         previous_n := previous_n + 1
539      end
540
541   is_order (r: BOOLEAN; n: INTEGER): BOOLEAN
542      do
543         check_order(n)
544         Result := r
545      end
546
547   never_here
548      do
549         sedb_breakpoint
550         std_output.put_string("TEST_SIMPLIFY_2: ERROR 'never_here' executed.%N")
551      end
552
553end -- class TEST_SIMPLIFY05
554--
555-- ------------------------------------------------------------------------------------------------------------------------------
556-- Copyright notice below. Please read.
557--
558-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
559-- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
560-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
561-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
562-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
563-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
564--
565-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
566-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
567--
568-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
569--
570-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
571-- ------------------------------------------------------------------------------------------------------------------------------