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