PageRenderTime 21ms CodeModel.GetById 16ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

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