/test/language/gc/test_popof3.e

http://github.com/tybor/Liberty · Specman e · 88 lines · 58 code · 3 blank · 27 comment · 3 complexity · a946fecdab185efa61bc06a7b70b6be7 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_POPOF3
  5. create {}
  6. make
  7. feature {ANY}
  8. make
  9. local
  10. hand: HAND; wins, losses: INTEGER; card1, card2, card3, card4, card5: INTEGER
  11. do
  12. create hand.make
  13. from
  14. card1 := 1
  15. until
  16. card1 > 48
  17. loop
  18. from
  19. card2 := card1 + 1
  20. until
  21. card2 > 49
  22. loop
  23. from
  24. card3 := card2 + 1
  25. until
  26. card3 > 50
  27. loop
  28. from
  29. card4 := card3 + 1
  30. until
  31. card4 > 51
  32. loop
  33. from
  34. card5 := card4 + 1
  35. until
  36. card5 > 52
  37. loop
  38. hand.deal(card1, card2, card3, card4, card5)
  39. if hand.wins then
  40. wins := wins + 1
  41. else
  42. losses := losses + 1
  43. end
  44. -- if
  45. card5 := card5 + 1
  46. end
  47. -- loop
  48. card4 := card4 + 1
  49. end
  50. -- loop
  51. card3 := card3 + 1
  52. end
  53. -- loop
  54. card2 := card2 + 1
  55. end
  56. -- loop
  57. card1 := card1 + 1
  58. end
  59. -- loop
  60. if 23940 /= wins then
  61. std_error.put_string("Error #1 in TEST_POPOF%N")
  62. end
  63. if 2598960 /= wins + losses then
  64. std_error.put_string("Error #1 in TEST_POPOF%N")
  65. end
  66. end
  67. end -- class TEST_POPOF3
  68. --
  69. -- ------------------------------------------------------------------------------------------------------------------------------
  70. -- Copyright notice below. Please read.
  71. --
  72. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  73. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  74. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  75. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  76. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  77. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  78. --
  79. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  80. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  81. --
  82. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  83. --
  84. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  85. -- ------------------------------------------------------------------------------------------------------------------------------