/test/language/gc/test_popof2.e

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