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