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_no_captures_on_safe_spaces (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/game-test.rb, line 223</span>
14 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_no_captures_on_safe_spaces</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>, []
46 <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA2A4</span>, <span class="ruby-value str">'a'</span>)
47 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
48 <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>]
49 <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>
50 <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>, []
51 <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">'a4'</span>]
52 <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>
53 <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>, []
54 <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>]
55 <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>
56 <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>, []
58 <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A4</span>, <span class="ruby-value str">'b'</span>)
59 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">2</span>
60 <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>]
61 <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>
62 <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>, []
63 <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">'a4'</span>]
64 <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>
65 <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>, []
66 <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">'a4'</span>]
67 <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>
68 <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>, []
69 <span class="ruby-keyword kw">end</span></pre>