PageRenderTime 21ms CodeModel.GetById 17ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/test/language/simplify/test_simplify04.e

http://github.com/tybor/Liberty
Specman e | 271 lines | 186 code | 5 blank | 80 comment | 40 complexity | 9b0819e5c4ed06d85dfcb5bb7193655f 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_SIMPLIFY04
  5   --
  6   -- All expressions of this test are finally constants.
  7   --
  8
  9create {}
 10   make
 11
 12feature {ANY}
 13   make
 14      local
 15         bool: BOOLEAN
 16      do
 17         assert(True)
 18         if True then
 19         else
 20            c_inline_c("#1 in boost_simplify04.")
 21         end
 22         --
 23         assert(not False)
 24         if not False then
 25         else
 26            c_inline_c("#2  in boost_simplify04.")
 27         end
 28         --
 29         assert(True and True)
 30         if True and True then
 31         else
 32            c_inline_c("#3  in boost_simplify04.")
 33         end
 34         --
 35         assert(not (False and True))
 36         if not (False and True) then
 37         else
 38            c_inline_c("#4  in boost_simplify04.")
 39         end
 40         --
 41         assert(not (True and False))
 42         if not (True and False) then
 43         else
 44            c_inline_c("#5  in boost_simplify04.")
 45         end
 46         --
 47         assert(not (False and then not bool))
 48         if not (False and then not bool) then
 49         else
 50            c_inline_c("#6  in boost_simplify04.")
 51         end
 52         --
 53         assert(True or False)
 54         if True or False then
 55         else
 56            c_inline_c("#7  in boost_simplify04.")
 57         end
 58         --
 59         assert(False or True)
 60         if False or True then
 61         else
 62            c_inline_c("#8  in boost_simplify04.")
 63         end
 64         --
 65         assert(True or True)
 66         if True or True then
 67         else
 68            c_inline_c("#9  in boost_simplify04.")
 69         end
 70         --
 71         assert(True or else bool)
 72         if True or else bool then
 73         else
 74            c_inline_c("#10  in boost_simplify04.")
 75         end
 76         --
 77         assert(False or else True)
 78         if False or else True then
 79         else
 80            c_inline_c("#11  in boost_simplify04.")
 81         end
 82         --
 83         assert(True or not bool)
 84         if True or not bool then
 85         else
 86            c_inline_c("#12  in boost_simplify04.")
 87         end
 88         --
 89         assert(True or else not bool)
 90         if True or else not bool then
 91         else
 92            c_inline_c("#13  in boost_simplify04.")
 93         end
 94         --
 95         assert(not (False and not bool))
 96         if not (False and not bool) then
 97         else
 98            c_inline_c("#14  in boost_simplify04.")
 99         end
100         --
101         assert(not (False and then not bool))
102         if not (False and then not bool) then
103         else
104            c_inline_c("#15  in boost_simplify04.")
105         end
106         --
107         assert(4 > 3)
108         if 4 > 3 then
109         else
110            c_inline_c("#16  in boost_simplify04.")
111         end
112         --
113         assert(not (3 > 4))
114         if not (3 > 4) then
115         else
116            c_inline_c("#17  in boost_simplify04.")
117         end
118         --
119         assert(4 >= 4)
120         if 4 >= 4 then
121         else
122            c_inline_c("#18  in boost_simplify04.")
123         end
124         --
125         assert(5 >= 4)
126         if 5 >= 4 then
127         else
128            c_inline_c("#19  in boost_simplify04.")
129         end
130         --
131         assert(not (4 >= 5))
132         if not (4 >= 5) then
133         else
134            c_inline_c("#20  in boost_simplify04.")
135         end
136         --
137         assert(not (4 < 3))
138         if not (4 < 3) then
139         else
140            c_inline_c("#21  in boost_simplify04.")
141         end
142         --
143         assert(3 < 4)
144         if 3 < 4 then
145         else
146            c_inline_c("#22  in boost_simplify04.")
147         end
148         --
149         assert(3 <= 3)
150         if 3 <= 3 then
151         else
152            c_inline_c("#23  in boost_simplify04.")
153         end
154         --
155         assert(3 <= 4)
156         if 3 <= 4 then
157         else
158            c_inline_c("#24  in boost_simplify04.")
159         end
160         --
161         assert(not (4 <= 3))
162         if not (4 <= 3) then
163         else
164            c_inline_c("#25  in boost_simplify04.")
165         end
166         --
167         assert(4 <= 3 + 1)
168         if 4 <= 3 + 1 then
169         else
170            c_inline_c("#26  in boost_simplify04.")
171         end
172         --
173         assert(4 <= 2 * 2)
174         if 4 <= 2 * 2 then
175         else
176            c_inline_c("#27  in boost_simplify04.")
177         end
178         --
179         assert(4 <= 6 - 2)
180         if 4 <= 6 - 2 then
181         else
182            c_inline_c("#28  in boost_simplify04.")
183         end
184         --
185         --***
186         -- assert(4 <= (8 // 2))
187         -- if      4 <= (8 // 2) then
188         -- else
189         --   c_inline_c("#29  in boost_simplify04.")
190         -- end
191         -- *** // is no longuer inlinable (Dom 20th august 2004)
192         --
193         assert(4 <= 1 + 2 * 2 + 1)
194         if 4 <= 1 + 2 * 2 + 1 then
195         else
196            c_inline_c("#30  in boost_simplify04.")
197         end
198         --
199         assert(2 = 2)
200         if 2 = 2 then
201         else
202            c_inline_c("#31  in boost_simplify04.")
203         end
204         --
205         assert(2 /= 3)
206         if 2 /= 3 then
207         else
208            c_inline_c("#32  in boost_simplify04.")
209         end
210         --
211         assert(2.51111 = 2.51111)
212         if 2.51111 = 2.51111 then
213         else
214            c_inline_c("#33  in boost_simplify04.")
215         end
216         --
217         assert(2.51112 /= 2.51111)
218         if 2.51112 /= 2.51112 then
219            c_inline_c("#34  in boost_simplify04.")
220         end
221         --
222         -- *** Following simplify should be done as soon as REAL_GENERAL
223         -- will be rebuild. (Dom august 20th 2004)
224         --***    assert(2 * 3.1415926 = 6.2831852)
225         --***    if      2 * 3.1415926 = 6.2831852 then
226         --***    else
227         --***       c_inline_c("#35  in boost_simplify04.")
228         --***    end
229         --***    --
230         --***    assert(2.00 * 3.1415926 = 6.2831852)
231         --***    if      2.00 * 3.1415926 = 6.2831852 then
232         --***    else
233         --***       c_inline_c("#36  in boost_simplify04.")
234         --***    end
235         --***    --
236         -- Final total count check:
237         assert(cpt = 33)
238      end
239
240   assert (b: BOOLEAN)
241      do
242         cpt := cpt + 1
243         if not b then
244            sedb_breakpoint
245            std_output.put_string("TEST_SIMPLIFY_1: ERROR Test # ")
246            std_output.put_integer(cpt)
247            std_output.put_string("%N")
248         end
249      end
250
251   cpt: INTEGER
252
253end -- class TEST_SIMPLIFY04
254--
255-- ------------------------------------------------------------------------------------------------------------------------------
256-- Copyright notice below. Please read.
257--
258-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
259-- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
260-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
261-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
262-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
263-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
264--
265-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
266-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
267--
268-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
269--
270-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
271-- ------------------------------------------------------------------------------------------------------------------------------