OSDN Git Service

Improved stability of test results.
[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   end
28
29   def test_hcbishop
30     klass = ShogiServer::Login.handicapped_game_name?("hcbishop_hoge-900-0")
31     board = klass.new
32     board.initial
33     str = board.to_s
34     answer = <<EOF
35 P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
36 P2 * -HI *  *  *  *  * -KA * 
37 P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
38 P4 *  *  *  *  *  *  *  *  * 
39 P5 *  *  *  *  *  *  *  *  * 
40 P6 *  *  *  *  *  *  *  *  * 
41 P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
42 P8 *  *  *  *  *  *  * +HI * 
43 P9+KY+KE+GI+KI+OU+KI+GI+KE+KY
44 +
45 EOF
46     assert_equal(answer, str)
47   end
48
49   def test_hcrook
50     klass = ShogiServer::Login.handicapped_game_name?("hcrook_hoge-900-0")
51     board = klass.new
52     board.initial
53     str = board.to_s
54     answer = <<EOF
55 P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
56 P2 * -HI *  *  *  *  * -KA * 
57 P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
58 P4 *  *  *  *  *  *  *  *  * 
59 P5 *  *  *  *  *  *  *  *  * 
60 P6 *  *  *  *  *  *  *  *  * 
61 P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
62 P8 * +KA *  *  *  *  *  *  * 
63 P9+KY+KE+GI+KI+OU+KI+GI+KE+KY
64 +
65 EOF
66     assert_equal(answer, str)
67   end
68
69   def test_hcrooklance
70     klass = ShogiServer::Login.handicapped_game_name?("hcrooklance_hoge-900-0")
71     board = klass.new
72     board.initial
73     str = board.to_s
74     answer = <<EOF
75 P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
76 P2 * -HI *  *  *  *  * -KA * 
77 P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
78 P4 *  *  *  *  *  *  *  *  * 
79 P5 *  *  *  *  *  *  *  *  * 
80 P6 *  *  *  *  *  *  *  *  * 
81 P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
82 P8 * +KA *  *  *  *  *  *  * 
83 P9 * +KE+GI+KI+OU+KI+GI+KE+KY
84 +
85 EOF
86     assert_equal(answer, str)
87   end
88
89   def test_hc2p
90     klass = ShogiServer::Login.handicapped_game_name?("hc2p_hoge-900-0")
91     board = klass.new
92     board.initial
93     str = board.to_s
94     answer = <<EOF
95 P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
96 P2 * -HI *  *  *  *  * -KA * 
97 P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
98 P4 *  *  *  *  *  *  *  *  * 
99 P5 *  *  *  *  *  *  *  *  * 
100 P6 *  *  *  *  *  *  *  *  * 
101 P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
102 P8 *  *  *  *  *  *  *  *  * 
103 P9+KY+KE+GI+KI+OU+KI+GI+KE+KY
104 +
105 EOF
106     assert_equal(answer, str)
107   end
108
109   def test_hc4p
110     klass = ShogiServer::Login.handicapped_game_name?("hc4p_hoge-900-0")
111     board = klass.new
112     board.initial
113     str = board.to_s
114     answer = <<EOF
115 P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
116 P2 * -HI *  *  *  *  * -KA * 
117 P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
118 P4 *  *  *  *  *  *  *  *  * 
119 P5 *  *  *  *  *  *  *  *  * 
120 P6 *  *  *  *  *  *  *  *  * 
121 P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
122 P8 *  *  *  *  *  *  *  *  * 
123 P9 * +KE+GI+KI+OU+KI+GI+KE * 
124 +
125 EOF
126     assert_equal(answer, str)
127   end
128
129   def test_hc6p
130     klass = ShogiServer::Login.handicapped_game_name?("hc6p_hoge-900-0")
131     board = klass.new
132     board.initial
133     str = board.to_s
134     answer = <<EOF
135 P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
136 P2 * -HI *  *  *  *  * -KA * 
137 P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
138 P4 *  *  *  *  *  *  *  *  * 
139 P5 *  *  *  *  *  *  *  *  * 
140 P6 *  *  *  *  *  *  *  *  * 
141 P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
142 P8 *  *  *  *  *  *  *  *  * 
143 P9 *  * +GI+KI+OU+KI+GI *  * 
144 +
145 EOF
146     assert_equal(answer, str)
147   end
148
149   def test_hc8p
150     klass = ShogiServer::Login.handicapped_game_name?("hc8p_hoge-900-0")
151     board = klass.new
152     board.initial
153     str = board.to_s
154     answer = <<EOF
155 P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
156 P2 * -HI *  *  *  *  * -KA * 
157 P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
158 P4 *  *  *  *  *  *  *  *  * 
159 P5 *  *  *  *  *  *  *  *  * 
160 P6 *  *  *  *  *  *  *  *  * 
161 P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
162 P8 *  *  *  *  *  *  *  *  * 
163 P9 *  *  * +KI+OU+KI *  *  * 
164 +
165 EOF
166     assert_equal(answer, str)
167   end
168
169   def test_hc10p
170     klass = ShogiServer::Login.handicapped_game_name?("hc10p_hoge-900-0")
171     board = klass.new
172     board.initial
173     str = board.to_s
174     answer = <<EOF
175 P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
176 P2 * -HI *  *  *  *  * -KA * 
177 P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
178 P4 *  *  *  *  *  *  *  *  * 
179 P5 *  *  *  *  *  *  *  *  * 
180 P6 *  *  *  *  *  *  *  *  * 
181 P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
182 P8 *  *  *  *  *  *  *  *  * 
183 P9 *  *  *  * +OU *  *  *  * 
184 +
185 EOF
186     assert_equal(answer, str)
187   end
188
189 end
190