1 <?xml version=
"1.0" encoding=
"iso-8859-1"?>
3 PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
8 <title>test_game_init (GameTest)
</title>
9 <meta http-equiv=
"Content-Type" content=
"text/html; charset=iso-8859-1" />
10 <link rel=
"stylesheet" href=
"../.././rdoc-style.css" type=
"text/css" media=
"screen" />
12 <body class=
"standalone-code">
13 <pre><span class=
"ruby-comment cmt"># File test/libttc_test.rb, line
13</span>
14 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">test_game_init
</span>
15 <span class=
"ruby-identifier">game
</span> =
<span class=
"ruby-constant">Game
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-value">6</span>,
<span class=
"ruby-value">6</span>,
<span class=
"ruby-value">6</span>,
<span class=
"ruby-value">6</span>,
<span class=
"ruby-value">6</span>)
17 <span class=
"ruby-identifier">pieceA1
</span> =
<span class=
"ruby-identifier">game
</span>.
<span class=
"ruby-identifier">pieces
</span>[
<span class=
"ruby-value str">'a1'
</span>]
18 <span class=
"ruby-identifier">pieceA2
</span> =
<span class=
"ruby-identifier">game
</span>.
<span class=
"ruby-identifier">pieces
</span>[
<span class=
"ruby-value str">'a2'
</span>]
19 <span class=
"ruby-identifier">pieceB2
</span> =
<span class=
"ruby-identifier">game
</span>.
<span class=
"ruby-identifier">pieces
</span>[
<span class=
"ruby-value str">'b2'
</span>]
21 <span class=
"ruby-identifier">posA
</span> =
<span class=
"ruby-identifier">game
</span>.
<span class=
"ruby-identifier">board
</span>.
<span class=
"ruby-identifier">positions
</span>[
<span class=
"ruby-value str">'a'
</span>]
22 <span class=
"ruby-identifier">posB
</span> =
<span class=
"ruby-identifier">game
</span>.
<span class=
"ruby-identifier">board
</span>.
<span class=
"ruby-identifier">positions
</span>[
<span class=
"ruby-value str">'b'
</span>]
23 <span class=
"ruby-identifier">posA3
</span> =
<span class=
"ruby-identifier">game
</span>.
<span class=
"ruby-identifier">board
</span>.
<span class=
"ruby-identifier">positions
</span>[
<span class=
"ruby-value str">'a3'
</span>]
24 <span class=
"ruby-identifier">posA4
</span> =
<span class=
"ruby-identifier">game
</span>.
<span class=
"ruby-identifier">board
</span>.
<span class=
"ruby-identifier">positions
</span>[
<span class=
"ruby-value str">'a4'
</span>]
25 <span class=
"ruby-identifier">posA5
</span> =
<span class=
"ruby-identifier">game
</span>.
<span class=
"ruby-identifier">board
</span>.
<span class=
"ruby-identifier">positions
</span>[
<span class=
"ruby-value str">'a5'
</span>]
27 <span class=
"ruby-identifier">moveA2A
</span> =
<span class=
"ruby-constant">Move
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-identifier">pieceA2
</span>,
<span class=
"ruby-identifier">posA
</span> ,
<span class=
"ruby-keyword kw">true
</span>)
28 <span class=
"ruby-identifier">moveA1A5
</span> =
<span class=
"ruby-constant">Move
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-identifier">pieceA1
</span>,
<span class=
"ruby-identifier">posA5
</span>)
29 <span class=
"ruby-identifier">moveA2A4
</span> =
<span class=
"ruby-constant">Move
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-identifier">pieceA2
</span>,
<span class=
"ruby-identifier">posA4
</span>)
30 <span class=
"ruby-identifier">moveA2A3
</span> =
<span class=
"ruby-constant">Move
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-identifier">pieceA2
</span>,
<span class=
"ruby-identifier">posA3
</span>)
31 <span class=
"ruby-identifier">moveB2A5
</span> =
<span class=
"ruby-constant">Move
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-identifier">pieceB2
</span>,
<span class=
"ruby-identifier">posA5
</span>)
32 <span class=
"ruby-identifier">moveB2A3
</span> =
<span class=
"ruby-constant">Move
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-identifier">pieceB2
</span>,
<span class=
"ruby-identifier">posA3
</span>)
33 <span class=
"ruby-identifier">moveB2A4
</span> =
<span class=
"ruby-constant">Move
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-identifier">pieceB2
</span>,
<span class=
"ruby-identifier">posA4
</span>)
35 <span class=
"ruby-identifier">assert_equal
</span> [],
<span class=
"ruby-identifier">game
</span>.
<span class=
"ruby-identifier">history
</span>
36 <span class=
"ruby-identifier">assert_equal
</span> <span class=
"ruby-identifier">game
</span>.
<span class=
"ruby-identifier">pieces
</span>[
<span class=
"ruby-value str">'a1'
</span>].
<span class=
"ruby-identifier">position
</span>,
<span class=
"ruby-identifier">game
</span>.
<span class=
"ruby-identifier">board
</span>.
<span class=
"ruby-identifier">positions
</span>[
<span class=
"ruby-value str">'a'
</span>]
37 <span class=
"ruby-identifier">assert_equal
</span> <span class=
"ruby-identifier">game
</span>.
<span class=
"ruby-identifier">pieces
</span>[
<span class=
"ruby-value str">'a1'
</span>].
<span class=
"ruby-identifier">captured
</span>,
<span class=
"ruby-keyword kw">false
</span>
38 <span class=
"ruby-identifier">assert_equal
</span> <span class=
"ruby-identifier">game
</span>.
<span class=
"ruby-identifier">pieces
</span>[
<span class=
"ruby-value str">'a1'
</span>].
<span class=
"ruby-identifier">contains
</span>, []
39 <span class=
"ruby-identifier">assert_equal
</span> <span class=
"ruby-identifier">game
</span>.
<span class=
"ruby-identifier">pieces
</span>[
<span class=
"ruby-value str">'a2'
</span>].
<span class=
"ruby-identifier">position
</span>,
<span class=
"ruby-identifier">game
</span>.
<span class=
"ruby-identifier">board
</span>.
<span class=
"ruby-identifier">positions
</span>[
<span class=
"ruby-value str">'a'
</span>]
40 <span class=
"ruby-identifier">assert_equal
</span> <span class=
"ruby-identifier">game
</span>.
<span class=
"ruby-identifier">pieces
</span>[
<span class=
"ruby-value str">'a2'
</span>].
<span class=
"ruby-identifier">captured
</span>,
<span class=
"ruby-keyword kw">false
</span>
41 <span class=
"ruby-identifier">assert_equal
</span> <span class=
"ruby-identifier">game
</span>.
<span class=
"ruby-identifier">pieces
</span>[
<span class=
"ruby-value str">'a2'
</span>].
<span class=
"ruby-identifier">contains
</span>, []
42 <span class=
"ruby-identifier">assert_equal
</span> <span class=
"ruby-identifier">game
</span>.
<span class=
"ruby-identifier">pieces
</span>[
<span class=
"ruby-value str">'b2'
</span>].
<span class=
"ruby-identifier">position
</span>,
<span class=
"ruby-identifier">game
</span>.
<span class=
"ruby-identifier">board
</span>.
<span class=
"ruby-identifier">positions
</span>[
<span class=
"ruby-value str">'b'
</span>]
43 <span class=
"ruby-identifier">assert_equal
</span> <span class=
"ruby-identifier">game
</span>.
<span class=
"ruby-identifier">pieces
</span>[
<span class=
"ruby-value str">'b2'
</span>].
<span class=
"ruby-identifier">captured
</span>,
<span class=
"ruby-keyword kw">false
</span>
44 <span class=
"ruby-identifier">assert_equal
</span> <span class=
"ruby-identifier">game
</span>.
<span class=
"ruby-identifier">pieces
</span>[
<span class=
"ruby-value str">'b2'
</span>].
<span class=
"ruby-identifier">contains
</span>, []
45 <span class=
"ruby-keyword kw">end
</span></pre>