OSDN Git Service

Getting an absolute location of this file was wrong if it was a synbolic link. This...
[shogi-server/shogi-server.git] / test / TC_handicapped_boards.rb
1 $:.unshift File.join(File.dirname(__FILE__), "..")
2
3 require 'test/unit'
4 require 'shogi_server'
5 require 'shogi_server/handicapped_boards'
6
7 class TestHandicappedGameName < Test::Unit::TestCase
8
9   def test_hclance
10     klass = ShogiServer::Login.handicapped_game_name?("hclance_hoge-900-0")
11     board = klass.new
12     board.initial
13     str = board.to_s
14     answer = <<EOF
15 P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
16 P2 * -HI *  *  *  *  * -KA * 
17 P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
18 P4 *  *  *  *  *  *  *  *  * 
19 P5 *  *  *  *  *  *  *  *  * 
20 P6 *  *  *  *  *  *  *  *  * 
21 P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
22 P8 * +KA *  *  *  *  * +HI * 
23 P9 * +KE+GI+KI+OU+KI+GI+KE+KY
24 +
25 EOF
26     assert_equal(answer, str)
27     assert_equal(answer, board.initial_string)
28   end
29
30   def test_hcbishop
31     klass = ShogiServer::Login.handicapped_game_name?("hcbishop_hoge-900-0")
32     board = klass.new
33     board.initial
34     str = board.to_s
35     answer = <<EOF
36 P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
37 P2 * -HI *  *  *  *  * -KA * 
38 P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
39 P4 *  *  *  *  *  *  *  *  * 
40 P5 *  *  *  *  *  *  *  *  * 
41 P6 *  *  *  *  *  *  *  *  * 
42 P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
43 P8 *  *  *  *  *  *  * +HI * 
44 P9+KY+KE+GI+KI+OU+KI+GI+KE+KY
45 +
46 EOF
47     assert_equal(answer, str)
48     assert_equal(answer, board.initial_string)
49   end
50
51   def test_hcrook
52     klass = ShogiServer::Login.handicapped_game_name?("hcrook_hoge-900-0")
53     board = klass.new
54     board.initial
55     str = board.to_s
56     answer = <<EOF
57 P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
58 P2 * -HI *  *  *  *  * -KA * 
59 P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
60 P4 *  *  *  *  *  *  *  *  * 
61 P5 *  *  *  *  *  *  *  *  * 
62 P6 *  *  *  *  *  *  *  *  * 
63 P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
64 P8 * +KA *  *  *  *  *  *  * 
65 P9+KY+KE+GI+KI+OU+KI+GI+KE+KY
66 +
67 EOF
68     assert_equal(answer, str)
69     assert_equal(answer, board.initial_string)
70   end
71
72   def test_hcrooklance
73     klass = ShogiServer::Login.handicapped_game_name?("hcrooklance_hoge-900-0")
74     board = klass.new
75     board.initial
76     str = board.to_s
77     answer = <<EOF
78 P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
79 P2 * -HI *  *  *  *  * -KA * 
80 P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
81 P4 *  *  *  *  *  *  *  *  * 
82 P5 *  *  *  *  *  *  *  *  * 
83 P6 *  *  *  *  *  *  *  *  * 
84 P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
85 P8 * +KA *  *  *  *  *  *  * 
86 P9 * +KE+GI+KI+OU+KI+GI+KE+KY
87 +
88 EOF
89     assert_equal(answer, str)
90     assert_equal(answer, board.initial_string)
91   end
92
93   def test_hc2p
94     klass = ShogiServer::Login.handicapped_game_name?("hc2p_hoge-900-0")
95     board = klass.new
96     board.initial
97     str = board.to_s
98     answer = <<EOF
99 P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
100 P2 * -HI *  *  *  *  * -KA * 
101 P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
102 P4 *  *  *  *  *  *  *  *  * 
103 P5 *  *  *  *  *  *  *  *  * 
104 P6 *  *  *  *  *  *  *  *  * 
105 P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
106 P8 *  *  *  *  *  *  *  *  * 
107 P9+KY+KE+GI+KI+OU+KI+GI+KE+KY
108 +
109 EOF
110     assert_equal(answer, str)
111   end
112
113   def test_hc4p
114     klass = ShogiServer::Login.handicapped_game_name?("hc4p_hoge-900-0")
115     board = klass.new
116     board.initial
117     str = board.to_s
118     answer = <<EOF
119 P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
120 P2 * -HI *  *  *  *  * -KA * 
121 P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
122 P4 *  *  *  *  *  *  *  *  * 
123 P5 *  *  *  *  *  *  *  *  * 
124 P6 *  *  *  *  *  *  *  *  * 
125 P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
126 P8 *  *  *  *  *  *  *  *  * 
127 P9 * +KE+GI+KI+OU+KI+GI+KE * 
128 +
129 EOF
130     assert_equal(answer, str)
131     assert_equal(answer, board.initial_string)
132   end
133
134   def test_hc6p
135     klass = ShogiServer::Login.handicapped_game_name?("hc6p_hoge-900-0")
136     board = klass.new
137     board.initial
138     str = board.to_s
139     answer = <<EOF
140 P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
141 P2 * -HI *  *  *  *  * -KA * 
142 P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
143 P4 *  *  *  *  *  *  *  *  * 
144 P5 *  *  *  *  *  *  *  *  * 
145 P6 *  *  *  *  *  *  *  *  * 
146 P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
147 P8 *  *  *  *  *  *  *  *  * 
148 P9 *  * +GI+KI+OU+KI+GI *  * 
149 +
150 EOF
151     assert_equal(answer, str)
152   end
153
154   def test_hc8p
155     klass = ShogiServer::Login.handicapped_game_name?("hc8p_hoge-900-0")
156     board = klass.new
157     board.initial
158     str = board.to_s
159     answer = <<EOF
160 P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
161 P2 * -HI *  *  *  *  * -KA * 
162 P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
163 P4 *  *  *  *  *  *  *  *  * 
164 P5 *  *  *  *  *  *  *  *  * 
165 P6 *  *  *  *  *  *  *  *  * 
166 P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
167 P8 *  *  *  *  *  *  *  *  * 
168 P9 *  *  * +KI+OU+KI *  *  * 
169 +
170 EOF
171     assert_equal(answer, str)
172     assert_equal(answer, board.initial_string)
173   end
174
175   def test_hc10p
176     klass = ShogiServer::Login.handicapped_game_name?("hc10p_hoge-900-0")
177     board = klass.new
178     board.initial
179     str = board.to_s
180     answer = <<EOF
181 P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
182 P2 * -HI *  *  *  *  * -KA * 
183 P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
184 P4 *  *  *  *  *  *  *  *  * 
185 P5 *  *  *  *  *  *  *  *  * 
186 P6 *  *  *  *  *  *  *  *  * 
187 P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
188 P8 *  *  *  *  *  *  *  *  * 
189 P9 *  *  *  * +OU *  *  *  * 
190 +
191 EOF
192     assert_equal(answer, str)
193     assert_equal(answer, board.initial_string)
194   end
195
196 end
197