Initial commit
[trapthecap.git] / doc / classes / GameTest.src / .svn / text-base / M000016.html.svn-base
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE html
3 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
6 <html>
7 <head>
8 <title>test_game (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" />
11 </head>
12 <body class="standalone-code">
13 <pre><span class="ruby-comment cmt"># File test/game-test.rb, line 365</span>
14 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_game</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>)
16
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>]
20
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>]
26
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">moveA1A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA3</span>)
29 <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>)
30 <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>)
31 <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>)
32 <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>)
33 <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>)
34 <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
36 <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</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">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>]
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">captured</span>, <span class="ruby-keyword kw">false</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">'a1'</span>].<span class="ruby-identifier">contains</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">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>]
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">captured</span>, <span class="ruby-keyword kw">false</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">'a2'</span>].<span class="ruby-identifier">contains</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">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>]
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">captured</span>, <span class="ruby-keyword kw">false</span>
45 <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
47 <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'a'</span>)
48 <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>
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">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">'a5'</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">captured</span>, <span class="ruby-keyword kw">false</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">'a1'</span>].<span class="ruby-identifier">contains</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">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>]
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">captured</span>, <span class="ruby-keyword kw">false</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">'a2'</span>].<span class="ruby-identifier">contains</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">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>]
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">captured</span>, <span class="ruby-keyword kw">false</span>
57 <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
59 <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A3</span>, <span class="ruby-value str">'b'</span>)
60 <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>
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">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">'a5'</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">captured</span>, <span class="ruby-keyword kw">false</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">'a1'</span>].<span class="ruby-identifier">contains</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">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>]
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">captured</span>, <span class="ruby-keyword kw">false</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">'a2'</span>].<span class="ruby-identifier">contains</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">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">'a3'</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">captured</span>, <span class="ruby-keyword kw">false</span>
69 <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>, []
70
71 <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>)
72 <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">3</span>
73 <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">'a5'</span>]
74 <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>
75 <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>, []
76 <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>]
77 <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>
78 <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>, []
79 <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">'a3'</span>]
80 <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>
81 <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>, []
82
83 <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A5</span>, <span class="ruby-value str">'b'</span>)
84 <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">4</span>
85 <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">'a5'</span>]
86 <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">true</span>
87 <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>, []
88 <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>]
89 <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>
90 <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>, []
91 <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">'a5'</span>]
92 <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>
93 <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
94 <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>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
95
96 <span class="ruby-identifier">assert_raise</span>(<span class="ruby-constant">InvalidMoveError</span>) {<span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA1A3</span>, <span class="ruby-value str">'a'</span>)}
97 <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">4</span>
98 <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">'a5'</span>]
99 <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">true</span>
100 <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>, []
101 <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>]
102 <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>
103 <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>, []
104 <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">'a5'</span>]
105 <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>
106 <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
107 <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>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
108
109 <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA2A3</span>, <span class="ruby-value str">'a'</span>)
110 <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">5</span>
111 <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">'a5'</span>]
112 <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">true</span>
113 <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>, []
114 <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">'a3'</span>]
115 <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>
116 <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>, []
117 <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">'a5'</span>]
118 <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>
119 <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
120 <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>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
121
122 <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>)
123 <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">6</span>
124 <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">'a4'</span>]
125 <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">true</span>
126 <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>, []
127 <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">'a3'</span>]
128 <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>
129 <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>, []
130 <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>]
131 <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>
132 <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
133 <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>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
134
135 <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>)
136 <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">7</span>
137 <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">'a4'</span>]
138 <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">true</span>
139 <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>, []
140 <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>]
141 <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>
142 <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>, []
143 <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>]
144 <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>
145 <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
146 <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>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
147
148 <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A3</span>, <span class="ruby-value str">'b'</span>)
149 <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">8</span>
150 <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">'a3'</span>]
151 <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">true</span>
152 <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>, []
153 <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>]
154 <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>
155 <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>, []
156 <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">'a3'</span>]
157 <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>
158 <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
159 <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>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
160
161 <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA2A3</span>, <span class="ruby-value str">'a'</span>)
162 <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">9</span>
163 <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">'a3'</span>]
164 <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">true</span>
165 <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>, []
166 <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">'a3'</span>]
167 <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>
168 <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
169 <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceB2</span>)
170 <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>.<span class="ruby-identifier">length</span>, <span class="ruby-value">2</span>
171 <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">'a3'</span>]
172 <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">true</span>
173 <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>, []
174
175 <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA2A</span>, <span class="ruby-value str">'a'</span>)
176 <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">10</span>
177 <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>]
178 <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>
179 <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>, []
180 <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>]
181 <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>
182 <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>, []
183 <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">'a'</span>]
184 <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">true</span>
185 <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>, []
186 <span class="ruby-keyword kw">end</span></pre>
187 </body>
188 </html>