/test/language/simplify/test_simplify01.e

http://github.com/tybor/Liberty · Specman e · 155 lines · 124 code · 7 blank · 24 comment · 16 complexity · 1e94d9254600581f44a4e4e5b70c4cff 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_SIMPLIFY01
  5. --
  6. -- To check that the simplify work is actually done (for -boost mode only).
  7. --
  8. inherit
  9. EIFFELTEST_TOOLS
  10. create {}
  11. make
  12. feature {}
  13. make
  14. local
  15. b_true, b_false: BOOLEAN
  16. do
  17. b_true := True
  18. b_false := False
  19. if True then
  20. always_run
  21. else
  22. c_inline_c("*** WrongCcode #1 ***")
  23. end
  24. if False then
  25. c_inline_c("*** WrongCcode #2 ***")
  26. else
  27. always_run
  28. end
  29. if False then
  30. c_inline_c("*** WrongCcode #3 ***")
  31. elseif True then
  32. always_run
  33. else
  34. c_inline_c("*** WrongCcode #4 ***")
  35. end
  36. if 3 = 3 then
  37. always_run
  38. else
  39. c_inline_c("*** WrongCcode #5 ***")
  40. end
  41. if always_false then
  42. assert(False)
  43. end
  44. if always_true then
  45. always_run
  46. end
  47. if True then
  48. always_run
  49. end
  50. if False then
  51. else
  52. always_run
  53. end
  54. if False then
  55. c_inline_c("*** WrongCcode #6 ***")
  56. elseif False then
  57. c_inline_c("*** WrongCcode #7 ***")
  58. elseif True then
  59. always_run
  60. elseif True then
  61. c_inline_c("*** WrongCcode #8 ***")
  62. else
  63. c_inline_c("*** WrongCcode #9 ***")
  64. end
  65. if False then
  66. c_inline_c("*** WrongCcode #10 ***")
  67. elseif False then
  68. c_inline_c("*** WrongCcode #11 ***")
  69. elseif True then
  70. always_run
  71. elseif b_true then
  72. c_inline_c("*** WrongCcode #12 ***")
  73. else
  74. c_inline_c("*** WrongCcode #13 ***")
  75. end
  76. if b_false then
  77. assert(False)
  78. elseif False then
  79. c_inline_c("*** WrongCcode #14 ***")
  80. elseif True then
  81. always_run
  82. elseif b_true then
  83. c_inline_c("*** WrongCcode #15 ***")
  84. else
  85. c_inline_c("*** WrongCcode #16 ***")
  86. end
  87. if False then
  88. c_inline_c("*** WrongCcode #17 ***")
  89. elseif always_false then
  90. assert(False)
  91. else
  92. always_run
  93. end
  94. if b_true then
  95. always_run
  96. elseif always_false then
  97. assert(False)
  98. elseif always_false then
  99. assert(False)
  100. else
  101. assert(False)
  102. end
  103. if 4 #\\ 2 = 0 then
  104. always_run
  105. else
  106. c_inline_c("*** WrongCcode #18 ***")
  107. end
  108. if 4 #// 2 = 2 then
  109. always_run
  110. else
  111. c_inline_c("*** WrongCcode #19 ***")
  112. end
  113. if 2 = 2 then
  114. always_run
  115. else
  116. c_inline_c("*** WrongCcode #20 ***")
  117. end
  118. end
  119. always_run
  120. do
  121. assert(True)
  122. end
  123. always_true: BOOLEAN
  124. do
  125. Result := True
  126. end
  127. always_false: BOOLEAN
  128. do
  129. end
  130. end -- class TEST_SIMPLIFY01
  131. --
  132. -- ------------------------------------------------------------------------------------------------------------------------------
  133. -- Copyright notice below. Please read.
  134. --
  135. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  136. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  137. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  138. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  139. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  140. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  141. --
  142. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  143. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  144. --
  145. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  146. --
  147. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  148. -- ------------------------------------------------------------------------------------------------------------------------------