PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

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