icu_tournament 1.2.8 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/lib/icu_tournament.rb +1 -1
- data/lib/icu_tournament/federation.rb +6 -0
- data/lib/icu_tournament/player.rb +7 -7
- data/lib/icu_tournament/tournament.rb +11 -10
- data/lib/icu_tournament/tournament_fcsv.rb +14 -12
- data/lib/icu_tournament/tournament_krause.rb +10 -7
- data/lib/icu_tournament/tournament_sp.rb +27 -63
- data/lib/icu_tournament/tournament_spx.rb +397 -0
- data/lib/icu_tournament/version.rb +1 -1
- data/spec/player_spec.rb +50 -36
- data/spec/tournament_fcsv_spec.rb +50 -50
- data/spec/tournament_krause_spec.rb +26 -20
- data/spec/tournament_sp_spec.rb +46 -54
- data/spec/tournament_spx_spec.rb +379 -0
- metadata +7 -4
data/spec/player_spec.rb
CHANGED
@@ -12,14 +12,14 @@ module ICU
|
|
12
12
|
end.should_not raise_error
|
13
13
|
end
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
context "names" do
|
17
17
|
it "should be specified in constructor" do
|
18
18
|
p = Player.new('Mark', 'Orr', 1)
|
19
19
|
p.first_name.should == 'Mark'
|
20
20
|
p.last_name.should == 'Orr'
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
it "should be resettable via accessors" do
|
24
24
|
p = Player.new('Mark', 'Orr', 1)
|
25
25
|
p.first_name= 'Gary'
|
@@ -27,22 +27,22 @@ module ICU
|
|
27
27
|
p.first_name.should == 'Gary'
|
28
28
|
p.last_name.should == 'Kasparov'
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
it "should not contain invalid characters" do
|
32
32
|
lambda { Player.new('12', 'Orr', 1) }.should raise_error(/invalid first name/)
|
33
33
|
lambda { Player.new('Mark', '*!', 1) }.should raise_error(/invalid last name/)
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
it "should not have empty last name" do
|
37
37
|
lambda { Player.new('Mark', '', 1) }.should raise_error(/invalid last name/)
|
38
38
|
lambda { Player.new('', 'Orr', 1) }.should raise_error(/invalid first name/)
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
it "both names can be returned together" do
|
42
42
|
p = Player.new('Mark', 'Orr', 1)
|
43
43
|
p.name.should == 'Orr, Mark'
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
it "names should be automatically canonicalised" do
|
47
47
|
p = Player.new(' maRk J l ', ' ORR', 1)
|
48
48
|
p.name.should == 'Orr, Mark J. L.'
|
@@ -52,7 +52,7 @@ module ICU
|
|
52
52
|
p.name.should == "O'Mefisto, Z."
|
53
53
|
end
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
context "number" do
|
57
57
|
it "should just be an integer" do
|
58
58
|
Player.new('Mark', 'Orr', 3).num.should == 3
|
@@ -62,7 +62,7 @@ module ICU
|
|
62
62
|
lambda { Player.new('Mark', 'Orr', ' ') }.should raise_error(/invalid integer/)
|
63
63
|
end
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
context "local ID" do
|
67
67
|
it "defaults to nil" do
|
68
68
|
Player.new('Mark', 'Orr', 3).id.should be_nil
|
@@ -99,7 +99,7 @@ module ICU
|
|
99
99
|
lambda { Player.new('Danny', 'Kopec', 3, :fed => 'US') }.should raise_error(/invalid federation/)
|
100
100
|
end
|
101
101
|
end
|
102
|
-
|
102
|
+
|
103
103
|
context "title" do
|
104
104
|
it "defaults to nil" do
|
105
105
|
Player.new('Mark', 'Orr', 3).title.should be_nil
|
@@ -118,7 +118,7 @@ module ICU
|
|
118
118
|
lambda { Player.new('Mark', 'Orr', 3, :title => 'Dr') }.should raise_error(/invalid chess title/)
|
119
119
|
end
|
120
120
|
end
|
121
|
-
|
121
|
+
|
122
122
|
context "rating" do
|
123
123
|
it "defaults to nil" do
|
124
124
|
Player.new('Mark', 'Orr', 3).rating.should be_nil
|
@@ -132,7 +132,21 @@ module ICU
|
|
132
132
|
lambda { Player.new('Mark', 'Orr', 3, :rating => 'IM') }.should raise_error(/invalid positive integer/)
|
133
133
|
end
|
134
134
|
end
|
135
|
-
|
135
|
+
|
136
|
+
context "FIDE rating" do
|
137
|
+
it "defaults to nil" do
|
138
|
+
Player.new('Mark', 'Orr', 3).fide_rating.should be_nil
|
139
|
+
Player.new('Mark', 'Orr', 3, :fide_rating => ' ').fide_rating.should be_nil
|
140
|
+
end
|
141
|
+
|
142
|
+
it "should be a positive integer" do
|
143
|
+
Player.new('Gary', 'Kasparov', 1, :fide_rating => 2800).fide_rating.should == 2800
|
144
|
+
Player.new('Mark', 'Orr', 2, :fide_rating => ' 2200 ').fide_rating.should == 2200
|
145
|
+
lambda { Player.new('Mark', 'Orr', 3, :fide_rating => -2100) }.should raise_error(/invalid positive integer/)
|
146
|
+
lambda { Player.new('Mark', 'Orr', 3, :fide_rating => 'IM') }.should raise_error(/invalid positive integer/)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
136
150
|
context "rank" do
|
137
151
|
it "defaults to nil" do
|
138
152
|
Player.new('Mark', 'Orr', 3).rank.should be_nil
|
@@ -145,7 +159,7 @@ module ICU
|
|
145
159
|
lambda { Player.new('Mark', 'Orr', 3, :rank => ' -1 ') }.should raise_error(/invalid positive integer/)
|
146
160
|
end
|
147
161
|
end
|
148
|
-
|
162
|
+
|
149
163
|
context "date of birth" do
|
150
164
|
it "defaults to nil" do
|
151
165
|
Player.new('Mark', 'Orr', 3).dob.should be_nil
|
@@ -157,7 +171,7 @@ module ICU
|
|
157
171
|
lambda { Player.new('Mark', 'Orr', 3, :dob => 'X') }.should raise_error(/invalid.*dob/)
|
158
172
|
end
|
159
173
|
end
|
160
|
-
|
174
|
+
|
161
175
|
context "gender" do
|
162
176
|
it "defaults to nil" do
|
163
177
|
Player.new('Mark', 'Orr', 3).gender.should be_nil
|
@@ -168,19 +182,19 @@ module ICU
|
|
168
182
|
Player.new('Mark', 'Orr', 3, :gender => 'male').gender.should == 'M'
|
169
183
|
Player.new('April', 'Cronin', 3, :gender => 'woman').gender.should == 'F'
|
170
184
|
end
|
171
|
-
|
185
|
+
|
172
186
|
it "should raise an exception if the gender is not specified properly" do
|
173
187
|
lambda { Player.new('Mark', 'Orr', 3, :gender => 'X') }.should raise_error(/invalid gender/)
|
174
188
|
end
|
175
189
|
end
|
176
|
-
|
190
|
+
|
177
191
|
context "results and points" do
|
178
192
|
it "should initialise to an empty array" do
|
179
193
|
results = Player.new('Mark', 'Orr', 3).results
|
180
194
|
results.should be_instance_of Array
|
181
195
|
results.size.should == 0
|
182
196
|
end
|
183
|
-
|
197
|
+
|
184
198
|
it "can be added to" do
|
185
199
|
player = Player.new('Mark', 'Orr', 3)
|
186
200
|
player.add_result(Result.new(1, 3, 'W', :opponent => 1))
|
@@ -191,12 +205,12 @@ module ICU
|
|
191
205
|
results.size.should == 3
|
192
206
|
player.points.should == 1.5
|
193
207
|
end
|
194
|
-
|
208
|
+
|
195
209
|
it "should not allow mismatched player numbers" do
|
196
210
|
player = Player.new('Mark', 'Orr', 3)
|
197
211
|
lambda { player.add_result(Result.new(1, 4, 'W', :opponent => 1)) }.should raise_error(/player number .* matched/)
|
198
212
|
end
|
199
|
-
|
213
|
+
|
200
214
|
it "should enforce unique round numbers" do
|
201
215
|
player = Player.new('Mark', 'Orr', 3)
|
202
216
|
player.add_result(Result.new(1, 3, 'W', :opponent => 1))
|
@@ -204,7 +218,7 @@ module ICU
|
|
204
218
|
lambda { player.add_result(Result.new(2, 3, 'L', :opponent => 4)) }.should raise_error(/round number .* unique/)
|
205
219
|
end
|
206
220
|
end
|
207
|
-
|
221
|
+
|
208
222
|
context "looking up results" do
|
209
223
|
before(:all) do
|
210
224
|
@p = Player.new('Mark', 'Orr', 1)
|
@@ -212,7 +226,7 @@ module ICU
|
|
212
226
|
@p.add_result(Result.new(2, 1, 'W', :opponent => 13, :score => 'W', :colour => 'B'))
|
213
227
|
@p.add_result(Result.new(3, 1, 'W', :opponent => 7, :score => 'D', :colour => 'W'))
|
214
228
|
end
|
215
|
-
|
229
|
+
|
216
230
|
it "should find results by round number" do
|
217
231
|
@p.find_result(1).opponent.should == 37
|
218
232
|
@p.find_result(2).opponent.should == 13
|
@@ -220,14 +234,14 @@ module ICU
|
|
220
234
|
@p.find_result(4).should be_nil
|
221
235
|
end
|
222
236
|
end
|
223
|
-
|
237
|
+
|
224
238
|
context "merge" do
|
225
239
|
before(:each) do
|
226
240
|
@p1 = Player.new('Mark', 'Orr', 1, :id => 1350)
|
227
241
|
@p2 = Player.new('Mark', 'Orr', 2, :rating => 2100, :title => 'IM', :fed => 'IRL', :fide => 2500035)
|
228
242
|
@p3 = Player.new('Gearoidin', 'Ui Laighleis', 3, :rating => 1600, :title => 'WIM', :fed => 'IRL', :fide => 2501171)
|
229
243
|
end
|
230
|
-
|
244
|
+
|
231
245
|
it "takes on the ID, rating, title and fed of the other player but not the player number" do
|
232
246
|
@p1.merge(@p2)
|
233
247
|
@p1.num.should == 1
|
@@ -237,37 +251,37 @@ module ICU
|
|
237
251
|
@p1.fed.should == 'IRL'
|
238
252
|
@p1.fide.should == 2500035
|
239
253
|
end
|
240
|
-
|
254
|
+
|
241
255
|
it "should have a kind of symmetry" do
|
242
256
|
p1 = @p1.dup
|
243
257
|
p2 = @p2.dup
|
244
258
|
p1.merge(p2).eql?(@p2.merge(@p1))
|
245
259
|
end
|
246
|
-
|
260
|
+
|
247
261
|
it "cannot be done with unequal objects" do
|
248
262
|
lambda { @p1.merge(@p3) }.should raise_error(/cannot merge.*not equal/)
|
249
263
|
end
|
250
264
|
end
|
251
|
-
|
265
|
+
|
252
266
|
context "renumber the player numbers" do
|
253
267
|
before(:each) do
|
254
268
|
@p = Player.new('Mark', 'Orr', 10)
|
255
269
|
@p.add_result(Result.new(1, 10, 'W', :opponent => 20))
|
256
270
|
@p.add_result(Result.new(2, 10, 'W', :opponent => 30))
|
257
271
|
end
|
258
|
-
|
272
|
+
|
259
273
|
it "should renumber successfully if the map has the relevant player numbers" do
|
260
274
|
map = { 10 => 1, 20 => 2, 30 => 3 }
|
261
275
|
@p.renumber(map).num.should == 1
|
262
276
|
@p.results.map{ |r| r.opponent }.sort.join('').should == '23'
|
263
277
|
end
|
264
|
-
|
278
|
+
|
265
279
|
it "should raise exception if a player number is not in the map" do
|
266
280
|
lambda { @p.renumber({ 100 => 1, 20 => 2, 30 => 3 }) }.should raise_error(/player.*10.*not found/)
|
267
281
|
lambda { @p.renumber({ 10 => 1, 200 => 2, 30 => 3 }) }.should raise_error(/opponent.*20.*not found/)
|
268
282
|
end
|
269
283
|
end
|
270
|
-
|
284
|
+
|
271
285
|
context "loose equality" do
|
272
286
|
before(:all) do
|
273
287
|
@mark1 = Player.new('Mark', 'Orr', 1)
|
@@ -276,26 +290,26 @@ module ICU
|
|
276
290
|
@mark4 = Player.new('Mark', 'Sax', 4, :def => 'HUN')
|
277
291
|
@john1 = Player.new('John', 'Orr', 5, :fed => 'IRL')
|
278
292
|
end
|
279
|
-
|
293
|
+
|
280
294
|
it "any player is equal to itself" do
|
281
295
|
(@mark1 == @mark1).should be_true
|
282
296
|
end
|
283
|
-
|
297
|
+
|
284
298
|
it "two players are equal if their names are the same and their federations do not conflict" do
|
285
299
|
(@mark1 == @mark2).should be_true
|
286
300
|
end
|
287
|
-
|
301
|
+
|
288
302
|
it "two players cannot be equal if they have different names" do
|
289
303
|
(@mark1 == @mark4).should be_false
|
290
304
|
(@mark1 == @john1).should be_false
|
291
305
|
end
|
292
|
-
|
306
|
+
|
293
307
|
it "two players cannot be equal if they have different federations" do
|
294
308
|
(@mark2 == @mark3).should be_false
|
295
309
|
(@mark1 == @mark3).should be_true
|
296
310
|
end
|
297
311
|
end
|
298
|
-
|
312
|
+
|
299
313
|
context "strict equality" do
|
300
314
|
before(:all) do
|
301
315
|
@mark1 = Player.new('Mark', 'Orr', 1)
|
@@ -304,18 +318,18 @@ module ICU
|
|
304
318
|
@mark4 = Player.new('Mark', 'Orr', 4, :rating => 2200)
|
305
319
|
@mark5 = Player.new('Mark', 'Orr', 5, :title => 'GM')
|
306
320
|
end
|
307
|
-
|
321
|
+
|
308
322
|
it "any player is equal to itself" do
|
309
323
|
@mark1.eql?(@mark1).should be_true
|
310
324
|
@mark1.eql?(@mark1).should be_true
|
311
325
|
end
|
312
|
-
|
326
|
+
|
313
327
|
it "two players are equal as long as their ID, rating and title do not conflict" do
|
314
328
|
@mark1.eql?(@mark2).should be_true
|
315
329
|
@mark3.eql?(@mark4).should be_true
|
316
330
|
@mark4.eql?(@mark5).should be_true
|
317
331
|
end
|
318
|
-
|
332
|
+
|
319
333
|
it "two players are not equal if their ID, rating or title conflict" do
|
320
334
|
@mark2.eql?(@mark3).should be_false
|
321
335
|
@mark2.eql?(@mark4).should be_false
|
@@ -9,7 +9,7 @@ module ICU
|
|
9
9
|
p.first_name.should == first
|
10
10
|
p.last_name.should == last
|
11
11
|
p.id.should == other[:id]
|
12
|
-
p.
|
12
|
+
p.fide_rating.should == other[:fide_rating]
|
13
13
|
p.fed.should == other[:fed]
|
14
14
|
p.title.should == other[:title]
|
15
15
|
p.results.size.should == results
|
@@ -58,9 +58,9 @@ CSV
|
|
58
58
|
|
59
59
|
it "should have correct player details" do
|
60
60
|
check_player(1, 'Gearoidin', 'Ui Laighleis', 4, 3, 2.0, :id => 3364)
|
61
|
-
check_player(2, 'April', 'Cronin', 1, 0, 1.0, :
|
62
|
-
check_player(3, 'Suzanne', 'Connolly', 1, 0, 0.5, :
|
63
|
-
check_player(4, 'Linda', 'Powell', 1, 0, 0.0, :
|
61
|
+
check_player(2, 'April', 'Cronin', 1, 0, 1.0, :fide_rating => 2005, :fed => 'IRL')
|
62
|
+
check_player(3, 'Suzanne', 'Connolly', 1, 0, 0.5, :fide_rating => 1950, :fed => 'IRL')
|
63
|
+
check_player(4, 'Linda', 'Powell', 1, 0, 0.0, :fide_rating => 1850, :fed => 'WLS')
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
@@ -154,9 +154,9 @@ CSV
|
|
154
154
|
it "should have correct player details" do
|
155
155
|
check_player(1, 'Gearoidin', 'Ui Laighleis', 2, 2, 1.0, :id => 3364)
|
156
156
|
check_player(4, 'Mark', 'Orr', 2, 2, 1.5, :id => 1350)
|
157
|
-
check_player(2, 'Gary', 'Kasparov', 1, 0, 0.5, :
|
158
|
-
check_player(3, 'April', 'Cronin', 2, 0, 1.0, :
|
159
|
-
check_player(5, 'Bobby', 'Fischer', 1, 0, 0.0, :
|
157
|
+
check_player(2, 'Gary', 'Kasparov', 1, 0, 0.5, :fide_rating => 2800, :fed => 'RUS', :title => 'GM')
|
158
|
+
check_player(3, 'April', 'Cronin', 2, 0, 1.0, :fide_rating => 2005, :fed => 'IRL')
|
159
|
+
check_player(5, 'Bobby', 'Fischer', 1, 0, 0.0, :fide_rating => 2700, :fed => 'USA', :title => 'GM')
|
160
160
|
end
|
161
161
|
end
|
162
162
|
|
@@ -194,10 +194,10 @@ CSV
|
|
194
194
|
end
|
195
195
|
|
196
196
|
it "should have correct player details" do
|
197
|
-
check_player(1, 'Gearoidin', 'Ui Laighleis', 2, 2, 1.0, :
|
198
|
-
check_player(3, 'Mark', 'Orr', 2, 2, 1.0, :
|
199
|
-
check_player(2, 'Gary', 'Kasparov', 1, 0, 0.5, :
|
200
|
-
check_player(4, 'April', 'Cronin', 1, 0, 0.5, :
|
197
|
+
check_player(1, 'Gearoidin', 'Ui Laighleis', 2, 2, 1.0, :fide_rating => 1800, :fed => 'IRL', :id => 3364)
|
198
|
+
check_player(3, 'Mark', 'Orr', 2, 2, 1.0, :fide_rating => 2100, :fed => 'IRL', :id => 1350, :title => 'IM')
|
199
|
+
check_player(2, 'Gary', 'Kasparov', 1, 0, 0.5, :fide_rating => 2800, :fed => 'RUS')
|
200
|
+
check_player(4, 'April', 'Cronin', 1, 0, 0.5, :fide_rating => 2005, :fed => 'IRL')
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
@@ -234,8 +234,8 @@ CSV
|
|
234
234
|
|
235
235
|
it "should have correct player details" do
|
236
236
|
check_player(1, 'Gearoidin', 'Ui Laighleis', 2, 2, 1.0, :id => 3364)
|
237
|
-
check_player(2, 'Gary', 'Kasparov', 1, 0, 0.5, :
|
238
|
-
check_player(3, 'Mark', 'Orr', 1, 0, 0.5, :
|
237
|
+
check_player(2, 'Gary', 'Kasparov', 1, 0, 0.5, :fide_rating => 2800, :fed => 'RUS', :title => 'GM')
|
238
|
+
check_player(3, 'Mark', 'Orr', 1, 0, 0.5, :fide_rating => 2100, :fed => 'IRL', :title => 'IM')
|
239
239
|
end
|
240
240
|
end
|
241
241
|
|
@@ -450,23 +450,23 @@ CSV
|
|
450
450
|
@t = ICU::Tournament.new("Isle of Man Masters, 2007", '2007-09-22')
|
451
451
|
@t.site = 'http://www.bcmchess.co.uk/monarch2007/'
|
452
452
|
@t.rounds = 9
|
453
|
-
@t.add_player(ICU::Player.new('Anthony', 'Fox', 1, :id => 456, :
|
454
|
-
@t.add_player(ICU::Player.new('Peter', 'Cafolla', 2, :id => 159, :
|
455
|
-
@t.add_player(ICU::Player.new('Peter P.', 'Taylor', 3, :
|
456
|
-
@t.add_player(ICU::Player.new('Egozi', 'Nadav', 4, :
|
457
|
-
@t.add_player(ICU::Player.new('Tim R.', 'Spanton', 5, :
|
458
|
-
@t.add_player(ICU::Player.new('Alan', 'Grant', 6, :
|
459
|
-
@t.add_player(ICU::Player.new('Alan J.', 'Walton', 7, :
|
460
|
-
@t.add_player(ICU::Player.new('Bernard', 'Bannink', 8, :
|
461
|
-
@t.add_player(ICU::Player.new('Roy', 'Phillips', 9, :
|
462
|
-
@t.add_player(ICU::Player.new('Oliver A.', 'Jackson', 10, :
|
453
|
+
@t.add_player(ICU::Player.new('Anthony', 'Fox', 1, :id => 456, :fide_rating => 2100, :fed => 'IRL'))
|
454
|
+
@t.add_player(ICU::Player.new('Peter', 'Cafolla', 2, :id => 159, :fide_rating => 2048, :fed => 'IRL'))
|
455
|
+
@t.add_player(ICU::Player.new('Peter P.', 'Taylor', 3, :fide_rating => 2209, :fed => 'ENG'))
|
456
|
+
@t.add_player(ICU::Player.new('Egozi', 'Nadav', 4, :fide_rating => 2205, :fed => 'ISR'))
|
457
|
+
@t.add_player(ICU::Player.new('Tim R.', 'Spanton', 5, :fide_rating => 1982, :fed => 'ENG'))
|
458
|
+
@t.add_player(ICU::Player.new('Alan', 'Grant', 6, :fide_rating => 2223, :fed => 'SCO'))
|
459
|
+
@t.add_player(ICU::Player.new('Alan J.', 'Walton', 7, :fide_rating => 2223, :fed => 'ENG'))
|
460
|
+
@t.add_player(ICU::Player.new('Bernard', 'Bannink', 8, :fide_rating => 2271, :fed => 'NED', :title => 'FM'))
|
461
|
+
@t.add_player(ICU::Player.new('Roy', 'Phillips', 9, :fide_rating => 2271, :fed => 'MAU'))
|
462
|
+
@t.add_player(ICU::Player.new('Oliver A.', 'Jackson', 10, :fide_rating => 2198, :fed => 'ENG'))
|
463
463
|
@t.add_player(ICU::Player.new('Van Den Berssalaar', 'Jeroen', 11, :fed => 'NED'))
|
464
|
-
@t.add_player(ICU::Player.new('Sam E.', 'Collins', 12, :
|
465
|
-
@t.add_player(ICU::Player.new('Doreen', 'Troyke', 13, :
|
466
|
-
@t.add_player(ICU::Player.new('Jonathan P.', 'Nelson', 14, :
|
467
|
-
@t.add_player(ICU::Player.new('Nadav', 'Egozi', 15, :
|
468
|
-
@t.add_player(ICU::Player.new('Manuel', 'Weeks', 16, :
|
469
|
-
@t.add_player(ICU::Player.new('Alan', 'Grant', 17, :
|
464
|
+
@t.add_player(ICU::Player.new('Sam E.', 'Collins', 12, :fide_rating => 2394, :fed => 'IRL', :title => 'IM'))
|
465
|
+
@t.add_player(ICU::Player.new('Doreen', 'Troyke', 13, :fide_rating => 2151, :fed => 'GER', :title => 'WFM'))
|
466
|
+
@t.add_player(ICU::Player.new('Jonathan P.', 'Nelson', 14, :fide_rating => 2282, :fed => 'ENG'))
|
467
|
+
@t.add_player(ICU::Player.new('Nadav', 'Egozi', 15, :fide_rating => 2205, :fed => 'ISR'))
|
468
|
+
@t.add_player(ICU::Player.new('Manuel', 'Weeks', 16, :fide_rating => 2200, :fed => 'AUS', :title => 'FM'))
|
469
|
+
@t.add_player(ICU::Player.new('Alan', 'Grant', 17, :fide_rating => 2223, :fed => 'SCO'))
|
470
470
|
@t.add_result(ICU::Result.new(1, 1, 'L', :opponent => 3, :colour => 'B'))
|
471
471
|
@t.add_result(ICU::Result.new(2, 1, 'D', :opponent => 4, :colour => 'W'))
|
472
472
|
@t.add_result(ICU::Result.new(3, 1, 'D', :opponent => 2, :colour => 'B'))
|
@@ -514,15 +514,15 @@ Total,4.0
|
|
514
514
|
CSV
|
515
515
|
@t = ICU::Tournament.new("Isle of Man Masters, 2007", '2007-09-22')
|
516
516
|
@t.site = 'http://www.bcmchess.co.uk/monarch2007/'
|
517
|
-
@t.add_player(ICU::Player.new('Anthony', 'Fox', 1, :id => 456, :
|
518
|
-
@t.add_player(ICU::Player.new('Peter P.', 'Taylor', 2, :
|
519
|
-
@t.add_player(ICU::Player.new('Egozi', 'Nadav', 3, :
|
520
|
-
@t.add_player(ICU::Player.new('Peter', 'Cafolla', 4, :
|
521
|
-
@t.add_player(ICU::Player.new('Tim R.', 'Spanton', 5, :
|
522
|
-
@t.add_player(ICU::Player.new('Alan', 'Grant', 6, :
|
523
|
-
@t.add_player(ICU::Player.new('Alan J.', 'Walton', 7, :
|
524
|
-
@t.add_player(ICU::Player.new('Bernard', 'Bannink', 8, :
|
525
|
-
@t.add_player(ICU::Player.new('Roy', 'Phillips', 9, :
|
517
|
+
@t.add_player(ICU::Player.new('Anthony', 'Fox', 1, :id => 456, :fide_rating => 2100, :fed => 'IRL'))
|
518
|
+
@t.add_player(ICU::Player.new('Peter P.', 'Taylor', 2, :fide_rating => 2209, :fed => 'ENG'))
|
519
|
+
@t.add_player(ICU::Player.new('Egozi', 'Nadav', 3, :fide_rating => 2205, :fed => 'ISR'))
|
520
|
+
@t.add_player(ICU::Player.new('Peter', 'Cafolla', 4, :fide_rating => 2048, :fed => 'IRL'))
|
521
|
+
@t.add_player(ICU::Player.new('Tim R.', 'Spanton', 5, :fide_rating => 1982, :fed => 'ENG'))
|
522
|
+
@t.add_player(ICU::Player.new('Alan', 'Grant', 6, :fide_rating => 2223, :fed => 'SCO'))
|
523
|
+
@t.add_player(ICU::Player.new('Alan J.', 'Walton', 7, :fide_rating => 2223, :fed => 'ENG'))
|
524
|
+
@t.add_player(ICU::Player.new('Bernard', 'Bannink', 8, :fide_rating => 2271, :fed => 'NED', :title => 'FM'))
|
525
|
+
@t.add_player(ICU::Player.new('Roy', 'Phillips', 9, :fide_rating => 2271, :fed => 'MAU'))
|
526
526
|
@t.add_result(ICU::Result.new(1, 1, 'L', :opponent => 2, :colour => 'B'))
|
527
527
|
@t.add_result(ICU::Result.new(2, 1, 'D', :opponent => 3, :colour => 'W'))
|
528
528
|
@t.add_result(ICU::Result.new(3, 1, 'D', :opponent => 4, :colour => 'B'))
|
@@ -559,8 +559,8 @@ CSV
|
|
559
559
|
it "should parse UTF-8" do
|
560
560
|
lambda { @t = @f.parse!(@csv) }.should_not raise_error
|
561
561
|
check_player(1, 'Gearoìdin', 'Uì Laighlèis', 2, 2, 1.0, :id => 3364)
|
562
|
-
check_player(2, 'Gary', 'Kasparov', 1, 0, 0.5, :
|
563
|
-
check_player(3, 'Mârk', 'Örr', 1, 0, 0.5, :
|
562
|
+
check_player(2, 'Gary', 'Kasparov', 1, 0, 0.5, :fide_rating => 2800, :fed => 'RUS', :title => 'GM')
|
563
|
+
check_player(3, 'Mârk', 'Örr', 1, 0, 0.5, :fide_rating => 2100, :fed => 'IRL', :title => 'IM')
|
564
564
|
@t.name.should == "Brätto Open, 2001"
|
565
565
|
end
|
566
566
|
|
@@ -568,8 +568,8 @@ CSV
|
|
568
568
|
@csv = @csv.encode("ISO-8859-1")
|
569
569
|
lambda { @t = @f.parse!(@csv) }.should_not raise_error
|
570
570
|
check_player(1, 'Gearoìdin', 'Uì Laighlèis', 2, 2, 1.0, :id => 3364)
|
571
|
-
check_player(2, 'Gary', 'Kasparov', 1, 0, 0.5, :
|
572
|
-
check_player(3, 'Mârk', 'Örr', 1, 0, 0.5, :
|
571
|
+
check_player(2, 'Gary', 'Kasparov', 1, 0, 0.5, :fide_rating => 2800, :fed => 'RUS', :title => 'GM')
|
572
|
+
check_player(3, 'Mârk', 'Örr', 1, 0, 0.5, :fide_rating => 2100, :fed => 'IRL', :title => 'IM')
|
573
573
|
@t.name.should == "Brätto Open, 2001"
|
574
574
|
end
|
575
575
|
end
|
@@ -608,8 +608,8 @@ CSV
|
|
608
608
|
file = "#{@s}/utf-8.csv"
|
609
609
|
lambda { @t = @p.parse_file!(file) }.should_not raise_error
|
610
610
|
check_player(1, 'Gearoìdin', 'Uì Laighlèis', 2, 2, 1.0, :id => 3364)
|
611
|
-
check_player(2, 'Gary', 'Kasparov', 1, 0, 0.5, :
|
612
|
-
check_player(3, 'Mârk', 'Örr', 1, 0, 0.5, :
|
611
|
+
check_player(2, 'Gary', 'Kasparov', 1, 0, 0.5, :fide_rating => 2800, :fed => 'RUS', :title => 'GM')
|
612
|
+
check_player(3, 'Mârk', 'Örr', 1, 0, 0.5, :fide_rating => 2100, :fed => 'IRL', :title => 'IM')
|
613
613
|
@t.name.should == "Brätto Open, 2001"
|
614
614
|
end
|
615
615
|
|
@@ -617,8 +617,8 @@ CSV
|
|
617
617
|
file = "#{@s}/latin-1.csv"
|
618
618
|
lambda { @t = @p.parse_file!(file) }.should_not raise_error
|
619
619
|
check_player(1, 'Gearoìdin', 'Uì Laighlèis', 2, 2, 1.0, :id => 3364)
|
620
|
-
check_player(2, 'Gary', 'Kasparov', 1, 0, 0.5, :
|
621
|
-
check_player(3, 'Mârk', 'Örr', 1, 0, 0.5, :
|
620
|
+
check_player(2, 'Gary', 'Kasparov', 1, 0, 0.5, :fide_rating => 2800, :fed => 'RUS', :title => 'GM')
|
621
|
+
check_player(3, 'Mârk', 'Örr', 1, 0, 0.5, :fide_rating => 2100, :fed => 'IRL', :title => 'IM')
|
622
622
|
@t.name.should == "Brätto Open, 2001"
|
623
623
|
end
|
624
624
|
end
|
@@ -630,10 +630,10 @@ CSV
|
|
630
630
|
@t.site = 'http://www.bcmchess.co.uk/monarch2007/'
|
631
631
|
@t.add_player(ICU::Player.new('Anthony', 'Fox', 1, :id => 456))
|
632
632
|
@t.add_player(ICU::Player.new('Peter', 'Cafolla', 2, :id => 159))
|
633
|
-
@t.add_player(ICU::Player.new('Peter P.', 'Taylor', 10, :
|
634
|
-
@t.add_player(ICU::Player.new('Egozi', 'Nadav', 20, :
|
635
|
-
@t.add_player(ICU::Player.new('Tim R.', 'Spanton', 30, :
|
636
|
-
@t.add_player(ICU::Player.new('Alan', 'Grant', 40, :
|
633
|
+
@t.add_player(ICU::Player.new('Peter P.', 'Taylor', 10, :fide_rating => 2209, :fed => 'ENG'))
|
634
|
+
@t.add_player(ICU::Player.new('Egozi', 'Nadav', 20, :fide_rating => 2205, :fed => 'ISR'))
|
635
|
+
@t.add_player(ICU::Player.new('Tim R.', 'Spanton', 30, :fide_rating => 1982, :fed => 'ENG'))
|
636
|
+
@t.add_player(ICU::Player.new('Alan', 'Grant', 40, :fide_rating => 2223, :fed => 'SCO'))
|
637
637
|
@t.add_result(ICU::Result.new(1, 1, 'W', :opponent => 10, :colour => 'W'))
|
638
638
|
@t.add_result(ICU::Result.new(1, 2, 'L', :opponent => 20, :colour => 'B'))
|
639
639
|
@t.add_result(ICU::Result.new(2, 1, 'D', :opponent => 30, :colour => 'B'))
|