sportdb-models 1.18.6 → 1.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +0 -106
- data/Rakefile +0 -1
- data/lib/sportdb/deleter.rb +1 -1
- data/lib/sportdb/models.rb +3 -88
- data/lib/sportdb/version.rb +2 -2
- data/test/helper.rb +0 -108
- metadata +2 -122
- data/lib/sportdb/indexers/team.rb +0 -87
- data/lib/sportdb/matcher.rb +0 -31
- data/lib/sportdb/pretty_printer.rb +0 -175
- data/lib/sportdb/reader.rb +0 -132
- data/lib/sportdb/reader_file.rb +0 -131
- data/lib/sportdb/reader_zip.rb +0 -172
- data/lib/sportdb/readers/assoc.rb +0 -54
- data/lib/sportdb/readers/event.rb +0 -253
- data/lib/sportdb/readers/event_meta.rb +0 -133
- data/lib/sportdb/readers/event_table.rb +0 -196
- data/lib/sportdb/readers/game.rb +0 -912
- data/lib/sportdb/readers/ground.rb +0 -53
- data/lib/sportdb/readers/league.rb +0 -54
- data/lib/sportdb/readers/season.rb +0 -83
- data/lib/sportdb/readers/squad_club.rb +0 -201
- data/lib/sportdb/readers/squad_national_team.rb +0 -173
- data/lib/sportdb/readers/team.rb +0 -53
- data/lib/sportdb/rsssf_reader.rb +0 -367
- data/lib/sportdb/utils.rb +0 -89
- data/lib/sportdb/utils_date.rb +0 -26
- data/lib/sportdb/utils_goals.rb +0 -20
- data/lib/sportdb/utils_group.rb +0 -63
- data/lib/sportdb/utils_map.rb +0 -44
- data/lib/sportdb/utils_round.rb +0 -165
- data/lib/sportdb/utils_scores.rb +0 -17
- data/lib/sportdb/utils_teams.rb +0 -48
- data/test/data/at-austria/2013_14/bl.txt +0 -227
- data/test/data/at-austria/2013_14/bl.yml +0 -30
- data/test/data/at-austria/2013_14/bl_ii.txt +0 -154
- data/test/data/at-austria/2013_14/el.txt +0 -4
- data/test/data/at-austria/2013_14/el.yml +0 -25
- data/test/data/at-austria/2013_14/squads/austria.txt +0 -40
- data/test/data/at-austria/2013_14/squads/salzburg.txt +0 -35
- data/test/data/at-austria/2014_15/1-bundesliga-ii.txt +0 -158
- data/test/data/at-austria/2014_15/1-bundesliga.yml +0 -18
- data/test/data/at-austria/2015_16/1-bundesliga-v2.conf.txt +0 -20
- data/test/data/at-austria/2015_16/1-bundesliga-v2.yml +0 -20
- data/test/data/at-austria/2015_16/1-bundesliga.conf.txt +0 -20
- data/test/data/at-austria/2015_16/1-bundesliga.yml +0 -24
- data/test/data/at-austria/2015_16/cup.yml +0 -77
- data/test/data/at-austria/leagues.txt +0 -11
- data/test/data/at-austria/teams.txt +0 -68
- data/test/data/at-austria/teams_2.txt +0 -21
- data/test/data/csv/de-2013-14--1-bundesliga.txt +0 -307
- data/test/data/de-deutschland/2013-14/1-bundesliga.yml +0 -26
- data/test/data/de-deutschland/leagues.txt +0 -4
- data/test/data/de-deutschland/teams.txt +0 -53
- data/test/data/eng-england/2015-16/1-premierleague-v2.yml +0 -2
- data/test/data/eng-england/2015-16/1-premierleague.yml +0 -5
- data/test/data/national-teams/assocs.txt +0 -231
- data/test/data/national-teams/europe/assocs.txt +0 -13
- data/test/data/national-teams/europe/teams.txt +0 -13
- data/test/data/national-teams/north-america/assocs.txt +0 -10
- data/test/data/national-teams/north-america/teams.txt +0 -7
- data/test/data/national-teams/teams.txt +0 -19
- data/test/data/players/europe/at-austria/players.txt +0 -45
- data/test/data/players/europe/de-deutschland/players.txt +0 -41
- data/test/data/players/south-america/br-brazil/players.txt +0 -51
- data/test/data/rsssf/at-2014-15--1-bundesliga.txt +0 -339
- data/test/data/rsssf/at-2015-16--1-bundesliga.txt +0 -18
- data/test/data/world-cup/1930/cup.txt +0 -71
- data/test/data/world-cup/1930/cup.yml +0 -23
- data/test/data/world-cup/1930/cup_goals.txt +0 -47
- data/test/data/world-cup/1930/cup_goals.yml +0 -23
- data/test/data/world-cup/1954/cup.txt +0 -90
- data/test/data/world-cup/1954/cup.yml +0 -30
- data/test/data/world-cup/1962/cup.txt +0 -86
- data/test/data/world-cup/1962/cup.yml +0 -32
- data/test/data/world-cup/1974/cup.yml +0 -35
- data/test/data/world-cup/1974/cup_finals.txt +0 -14
- data/test/data/world-cup/1974/cup_i.txt +0 -55
- data/test/data/world-cup/1974/cup_ii.txt +0 -34
- data/test/data/world-cup/2014/cup.txt +0 -5
- data/test/data/world-cup/2014/cup.yml +0 -54
- data/test/data/world-cup/2014/squads/br-brazil.txt +0 -46
- data/test/data/world-cup/2014/squads/de-deutschland.txt +0 -8
- data/test/data/world-cup/2014/squads/jp-japan.txt +0 -30
- data/test/data/world-cup/2014/squads/uy-uruguay.txt +0 -32
- data/test/data/world-cup/leagues.txt +0 -5
- data/test/data/world-cup/seasons_1930.txt +0 -4
- data/test/data/world-cup/seasons_1954.txt +0 -4
- data/test/data/world-cup/seasons_1962.txt +0 -4
- data/test/data/world-cup/seasons_1974.txt +0 -5
- data/test/data/world-cup/teams_1930.txt +0 -26
- data/test/data/world-cup/teams_1954.txt +0 -30
- data/test/data/world-cup/teams_1962.txt +0 -29
- data/test/data/world-cup/teams_1974.txt +0 -29
- data/test/test_assoc_reader.rb +0 -199
- data/test/test_event_meta_reader.rb +0 -47
- data/test/test_event_reader.rb +0 -64
- data/test/test_event_table_reader.rb +0 -57
- data/test/test_goals.rb +0 -107
- data/test/test_indexer_team.rb +0 -34
- data/test/test_load.rb +0 -61
- data/test/test_pp.rb +0 -35
- data/test/test_reader.rb +0 -88
- data/test/test_reader_from_string.rb +0 -63
- data/test/test_round_auto.rb +0 -370
- data/test/test_round_def.rb +0 -109
- data/test/test_round_header.rb +0 -183
- data/test/test_rsssf_reader.rb +0 -76
- data/test/test_squad_club_reader.rb +0 -76
- data/test/test_squad_national_team_reader.rb +0 -116
- data/test/test_standings.rb +0 -279
- data/test/test_standings_ii.rb +0 -46
- data/test/test_utils.rb +0 -124
data/test/test_standings.rb
DELETED
@@ -1,279 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
###
|
4
|
-
# to run use
|
5
|
-
# ruby -I ./lib -I ./test test/test_standings.rb
|
6
|
-
# or better
|
7
|
-
# rake -I ./lib test
|
8
|
-
|
9
|
-
|
10
|
-
require 'helper'
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
class TestStandings < MiniTest::Test
|
15
|
-
|
16
|
-
def setup
|
17
|
-
WorldDb.delete!
|
18
|
-
SportDb.delete!
|
19
|
-
## SportDb.read_builtin
|
20
|
-
|
21
|
-
add_countries
|
22
|
-
add_world_cup_1974
|
23
|
-
end
|
24
|
-
|
25
|
-
def add_countries
|
26
|
-
countries = [
|
27
|
-
['cd', 'Congo DR', 'COD' ],
|
28
|
-
['kr', 'South Korea', 'KOR' ],
|
29
|
-
['au', 'Australia', 'AUS' ],
|
30
|
-
|
31
|
-
['ar', 'Argentina', 'ARG' ],
|
32
|
-
['br', 'Brazil', 'BRA' ],
|
33
|
-
['bo', 'Bolivia', 'BOL' ],
|
34
|
-
['cl', 'Chile', 'CHI' ],
|
35
|
-
['co', 'Colombia', 'COL' ],
|
36
|
-
['uy', 'Uruguay', 'URU' ],
|
37
|
-
['pe', 'Peru', 'PER' ],
|
38
|
-
['py', 'Paraguay', 'PAR' ],
|
39
|
-
|
40
|
-
['mx', 'Mexico', 'MEX' ],
|
41
|
-
['us', 'United States', 'USA' ],
|
42
|
-
['ht', 'Haiti', 'HAI' ],
|
43
|
-
|
44
|
-
['at', 'Austria', 'AUT' ],
|
45
|
-
['be', 'Belgium', 'BEL' ],
|
46
|
-
['fr', 'France', 'FRA' ],
|
47
|
-
['rs', 'Serbia', 'SRB' ],
|
48
|
-
['ro', 'Romania', 'ROU' ],
|
49
|
-
['bg', 'Bulgaria', 'BUL' ],
|
50
|
-
['cz', 'Czech Republic', 'CZE' ],
|
51
|
-
['en', 'England', 'ENG' ],
|
52
|
-
['de', 'Germany', 'GER' ],
|
53
|
-
['hu', 'Hungary', 'HUN' ],
|
54
|
-
['it', 'Italy', 'ITA' ],
|
55
|
-
['ru', 'Russia', 'RUS' ],
|
56
|
-
['es', 'Spain', 'ESP' ],
|
57
|
-
['ch', 'Switzerland', 'SUI' ],
|
58
|
-
['sc', 'Scotland', 'SCO' ],
|
59
|
-
['tr', 'Turkey', 'TUR' ],
|
60
|
-
['nl', 'Netherlands', 'NED' ],
|
61
|
-
['pl', 'Poland', 'POL' ],
|
62
|
-
['se', 'Sweden', 'SWE' ],
|
63
|
-
]
|
64
|
-
|
65
|
-
countries.each do |country|
|
66
|
-
key = country[0]
|
67
|
-
name = country[1]
|
68
|
-
code = country[2]
|
69
|
-
Country.create!( key: key, name: name, code: code, pop: 1, area: 1 )
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
|
74
|
-
def add_world_cup_1974
|
75
|
-
teamreader = TestTeamReader.from_file( 'world-cup/teams_1974' )
|
76
|
-
teamreader.read()
|
77
|
-
|
78
|
-
seasonreader = TestSeasonReader.from_file( 'world-cup/seasons_1974' )
|
79
|
-
seasonreader.read()
|
80
|
-
|
81
|
-
leaguereader = TestLeagueReader.from_file( 'world-cup/leagues' )
|
82
|
-
leaguereader.read()
|
83
|
-
|
84
|
-
gamereader = TestGameReader.from_file( 'world-cup/1974/cup' )
|
85
|
-
gamereader.read()
|
86
|
-
|
87
|
-
ev = Event.find_by_key!( 'world.1974' )
|
88
|
-
|
89
|
-
assert_equal 16, ev.teams.count
|
90
|
-
assert_equal 38, ev.games.count
|
91
|
-
assert_equal 12, ev.rounds.count
|
92
|
-
end # method add_world_cup_1974
|
93
|
-
|
94
|
-
|
95
|
-
def test_alltime_standings
|
96
|
-
st = AlltimeStanding.create!( key: 'worldcup', title: 'All Time World Cup' )
|
97
|
-
|
98
|
-
assert_equal 1, AlltimeStanding.count
|
99
|
-
assert_equal 0, st.entries.count
|
100
|
-
|
101
|
-
## add some team entries
|
102
|
-
|
103
|
-
arg = Team.find_by_key!( 'arg' )
|
104
|
-
bra = Team.find_by_key!( 'bra' )
|
105
|
-
ita = Team.find_by_key!( 'ita' )
|
106
|
-
|
107
|
-
AlltimeStandingEntry.create!( standing_id: st.id, team_id: arg.id )
|
108
|
-
AlltimeStandingEntry.create!( standing_id: st.id, team_id: bra.id )
|
109
|
-
AlltimeStandingEntry.create!( standing_id: st.id, team_id: ita.id )
|
110
|
-
|
111
|
-
assert_equal 3, st.entries.count
|
112
|
-
assert_equal 3, AlltimeStandingEntry.count
|
113
|
-
|
114
|
-
st2 = AlltimeStandingEntry.first.standing # check back/parent ref w/ standing belongs_to assoc
|
115
|
-
assert_equal 'worldcup', st2.key
|
116
|
-
assert_equal 'All Time World Cup', st2.title
|
117
|
-
|
118
|
-
end # test_alltime_standings
|
119
|
-
|
120
|
-
|
121
|
-
def test_alltime_standings_recalc
|
122
|
-
st = AlltimeStanding.create!( key: 'worldcup', title: 'All Time World Cup' )
|
123
|
-
|
124
|
-
assert_equal 1, AlltimeStanding.count
|
125
|
-
assert_equal 0, st.entries.count
|
126
|
-
|
127
|
-
league = League.find_by_key!( 'world' )
|
128
|
-
|
129
|
-
st.recalc_for_league!( league )
|
130
|
-
assert_equal 16, st.entries.count
|
131
|
-
assert_equal 16, AlltimeStandingEntry.count
|
132
|
-
|
133
|
-
st.recalc_for_league!( league )
|
134
|
-
assert_equal 16, st.entries.count
|
135
|
-
assert_equal 16, AlltimeStandingEntry.count
|
136
|
-
|
137
|
-
|
138
|
-
# test merge to new team (not included)
|
139
|
-
at = Country.find_by_key!( 'at' )
|
140
|
-
aut = Team.create!( key: 'aut', title: 'Austria', code: 'AUT', country_id: at.id )
|
141
|
-
|
142
|
-
#### try merge teams
|
143
|
-
# merge (incl.) uruguay into bra
|
144
|
-
#
|
145
|
-
st.recalc_for_league!( league, merge: { 'bra' => 'uru',
|
146
|
-
'pol' => ['bul', 'yug'],
|
147
|
-
'aut' => 'aus' } )
|
148
|
-
|
149
|
-
assert_equal 13, st.entries.count
|
150
|
-
assert_equal 13, AlltimeStandingEntry.count
|
151
|
-
|
152
|
-
bra = Team.find_by_key!( 'bra' )
|
153
|
-
bra_stats = st.entries.where( team_id: bra.id ).first
|
154
|
-
assert_equal 2, bra_stats.recs
|
155
|
-
|
156
|
-
pol = Team.find_by_key!( 'pol' )
|
157
|
-
pol_stats = st.entries.where( team_id: pol.id ).first
|
158
|
-
assert_equal 3, pol_stats.recs
|
159
|
-
|
160
|
-
# test merge to new team (not included)
|
161
|
-
aut = Team.find_by_key!( 'aut' )
|
162
|
-
aut_stats = st.entries.where( team_id: aut.id ).first
|
163
|
-
assert_equal 1, aut_stats.recs
|
164
|
-
|
165
|
-
end # test_alltime_standings_recalc
|
166
|
-
|
167
|
-
|
168
|
-
def test_event_standings_recalc
|
169
|
-
ev = Event.find_by_key!( 'world.1974' )
|
170
|
-
|
171
|
-
assert_equal 16, ev.teams.count
|
172
|
-
|
173
|
-
st = EventStanding.create!( event_id: ev.id )
|
174
|
-
|
175
|
-
assert_equal 1, EventStanding.count
|
176
|
-
assert_equal 0, st.entries.count
|
177
|
-
|
178
|
-
st.recalc!
|
179
|
-
assert_equal 16, st.entries.count
|
180
|
-
|
181
|
-
st.recalc! ## try again (check update)
|
182
|
-
assert_equal 16, st.entries.count
|
183
|
-
|
184
|
-
## try global recalc
|
185
|
-
EventStandingEntry.delete_all
|
186
|
-
assert_equal 1, EventStanding.count
|
187
|
-
assert_equal 0, EventStandingEntry.count
|
188
|
-
|
189
|
-
EventStanding.recalc!
|
190
|
-
assert_equal 1, EventStanding.count
|
191
|
-
assert_equal 16, EventStandingEntry.count
|
192
|
-
|
193
|
-
end # test_event_standings_recalc
|
194
|
-
|
195
|
-
|
196
|
-
def test_group_standings_recalc
|
197
|
-
g2 = Group.find_by_pos!( 2 ) ## Group 2 | Yugoslavia Brazil Scotland Zaire
|
198
|
-
|
199
|
-
assert_equal 4, g2.teams.count
|
200
|
-
|
201
|
-
st2 = GroupStanding.create!( group_id: g2.id )
|
202
|
-
|
203
|
-
assert_equal 1, GroupStanding.count
|
204
|
-
assert_equal 0, st2.entries.count
|
205
|
-
|
206
|
-
st2.recalc!
|
207
|
-
assert_equal 4, st2.entries.count
|
208
|
-
|
209
|
-
st2.recalc! ## try again (check update)
|
210
|
-
assert_equal 4, st2.entries.count
|
211
|
-
|
212
|
-
## try global recalc
|
213
|
-
GroupStandingEntry.delete_all
|
214
|
-
assert_equal 1, GroupStanding.count
|
215
|
-
assert_equal 0, GroupStandingEntry.count
|
216
|
-
|
217
|
-
GroupStanding.recalc!
|
218
|
-
assert_equal 1, GroupStanding.count
|
219
|
-
assert_equal 4, GroupStandingEntry.count
|
220
|
-
|
221
|
-
end # test_group_standings_recalc
|
222
|
-
|
223
|
-
|
224
|
-
def test_group_standings
|
225
|
-
## Group 1 | East Germany West Germany Chile Australia
|
226
|
-
## Group 2 | Yugoslavia Brazil Scotland Zaire
|
227
|
-
## Group 3 | Netherlands Sweden Bulgaria Uruguay
|
228
|
-
## Group 4 | Poland Argentina Italy Haiti
|
229
|
-
|
230
|
-
g2 = Group.find_by_pos!( 2 )
|
231
|
-
g4 = Group.find_by_pos!( 4 )
|
232
|
-
|
233
|
-
assert_equal 4, g2.teams.count
|
234
|
-
assert_equal 4, g4.teams.count
|
235
|
-
|
236
|
-
st2 = GroupStanding.create!( group_id: g2.id )
|
237
|
-
st4 = GroupStanding.create!( group_id: g4.id )
|
238
|
-
|
239
|
-
assert_equal 2, GroupStanding.count
|
240
|
-
assert_equal 0, st2.entries.count
|
241
|
-
assert_equal 0, st4.entries.count
|
242
|
-
|
243
|
-
## add some team entries
|
244
|
-
bra = Team.find_by_key!( 'bra' )
|
245
|
-
arg = Team.find_by_key!( 'arg' )
|
246
|
-
ita = Team.find_by_key!( 'ita' )
|
247
|
-
|
248
|
-
GroupStandingEntry.create!( standing_id: st2.id, team_id: bra.id )
|
249
|
-
GroupStandingEntry.create!( standing_id: st4.id, team_id: arg.id )
|
250
|
-
GroupStandingEntry.create!( standing_id: st4.id, team_id: ita.id )
|
251
|
-
|
252
|
-
assert_equal 1, st2.entries.count
|
253
|
-
assert_equal 2, st4.entries.count
|
254
|
-
assert_equal 3, GroupStandingEntry.count
|
255
|
-
|
256
|
-
st2ii = st2.entries.first.standing # check back/parent ref w/ standing belongs_to assoc
|
257
|
-
assert_equal g2.title, st2ii.group.title
|
258
|
-
|
259
|
-
|
260
|
-
## Group I | Netherlands Brazil East Germany Argentina
|
261
|
-
## Group J | West Germany Poland Sweden Yugoslavia
|
262
|
-
|
263
|
-
gi = Group.find_by_pos!( 9 ) # note: I maps to 9
|
264
|
-
gj = Group.find_by_pos!( 10 ) # note: J maps to 10
|
265
|
-
|
266
|
-
assert_equal 4, gi.teams.count
|
267
|
-
assert_equal 4, gj.teams.count
|
268
|
-
|
269
|
-
sti = GroupStanding.create!( group_id: gi.id )
|
270
|
-
stj = GroupStanding.create!( group_id: gj.id )
|
271
|
-
|
272
|
-
assert_equal 4, GroupStanding.count
|
273
|
-
assert_equal 0, sti.entries.count
|
274
|
-
assert_equal 0, stj.entries.count
|
275
|
-
|
276
|
-
end # test_group_standings
|
277
|
-
|
278
|
-
|
279
|
-
end # class TestStandings
|
data/test/test_standings_ii.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
###
|
4
|
-
# to run use
|
5
|
-
# ruby -I ./lib -I ./test test/test_standings_ii.rb
|
6
|
-
# or better
|
7
|
-
# rake -I ./lib test
|
8
|
-
|
9
|
-
|
10
|
-
require 'helper'
|
11
|
-
|
12
|
-
class TestStandingsII < MiniTest::Test
|
13
|
-
|
14
|
-
def setup
|
15
|
-
WorldDb.delete!
|
16
|
-
SportDb.delete!
|
17
|
-
SportDb.read_builtin
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_bl
|
21
|
-
at = Country.create!( key: 'at', name: 'Austria', code: 'AUT', pop: 1, area: 1)
|
22
|
-
|
23
|
-
teamreader = TestTeamReader.from_file( 'at-austria/teams', country_id: at.id )
|
24
|
-
teamreader.read()
|
25
|
-
|
26
|
-
leaguereader = TestLeagueReader.from_file( 'at-austria/leagues', country_id: at.id )
|
27
|
-
leaguereader.read()
|
28
|
-
|
29
|
-
## check/fix: is country_id more_attribs needed? why? why not?
|
30
|
-
gamereader = TestGameReader.from_file( 'at-austria/2013_14/bl', country_id: at.id )
|
31
|
-
gamereader.read()
|
32
|
-
|
33
|
-
bl = Event.find_by_key!( 'at.2013/14' )
|
34
|
-
|
35
|
-
assert_equal 10, bl.teams.count
|
36
|
-
assert_equal 36, bl.rounds.count
|
37
|
-
assert_equal 180, bl.games.count # 36x5 = 180
|
38
|
-
|
39
|
-
standings = SportDb::Standings.new
|
40
|
-
standings.update( bl.games )
|
41
|
-
|
42
|
-
pp standings.to_a
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
end # class TestStandingsII
|
data/test/test_utils.rb
DELETED
@@ -1,124 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
###
|
4
|
-
# to run use
|
5
|
-
# ruby -I ./lib -I ./test test/test_lang.rb
|
6
|
-
# or better
|
7
|
-
# rake -I ./lib test
|
8
|
-
|
9
|
-
require 'helper'
|
10
|
-
|
11
|
-
class TestUtils < MiniTest::Test
|
12
|
-
|
13
|
-
def test_is_group_def
|
14
|
-
SportDb.lang.lang = 'en'
|
15
|
-
|
16
|
-
lines = [
|
17
|
-
'Group A |',
|
18
|
-
'Group B |'
|
19
|
-
]
|
20
|
-
|
21
|
-
reader = Reader.new
|
22
|
-
|
23
|
-
lines.each do |line|
|
24
|
-
assert_equal true, reader.is_group_def?( line )
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_is_group
|
29
|
-
SportDb.lang.lang = 'en'
|
30
|
-
|
31
|
-
lines = [
|
32
|
-
'Group A',
|
33
|
-
'Group A:',
|
34
|
-
'[Group A]'
|
35
|
-
]
|
36
|
-
|
37
|
-
reader = Reader.new
|
38
|
-
|
39
|
-
lines.each do |line|
|
40
|
-
assert_equal true, reader.is_group?( line )
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
|
45
|
-
def test_is_round_def
|
46
|
-
SportDb.lang.lang = 'en'
|
47
|
-
|
48
|
-
lines = [
|
49
|
-
'Matchday 1 |',
|
50
|
-
'Round 1 |'
|
51
|
-
]
|
52
|
-
|
53
|
-
reader = Reader.new
|
54
|
-
|
55
|
-
lines.each do |line|
|
56
|
-
assert_equal true, reader.is_round_def?( line )
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_is_round
|
61
|
-
SportDb.lang.lang = 'en'
|
62
|
-
|
63
|
-
lines = [
|
64
|
-
'Matchday 1',
|
65
|
-
'[Matchday 1]',
|
66
|
-
'Matchday 1:',
|
67
|
-
'Round 1'
|
68
|
-
]
|
69
|
-
|
70
|
-
reader = Reader.new
|
71
|
-
|
72
|
-
lines.each do |line|
|
73
|
-
assert_equal true, reader.is_round?( line )
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
|
78
|
-
def test_is_knockout_round
|
79
|
-
SportDb.lang.lang = 'en'
|
80
|
-
|
81
|
-
lines = [
|
82
|
-
'(4) Quarter-finals',
|
83
|
-
'(5) Semi-finals',
|
84
|
-
'(6) Final'
|
85
|
-
]
|
86
|
-
|
87
|
-
reader = Reader.new
|
88
|
-
|
89
|
-
lines.each do |line|
|
90
|
-
assert_equal true, reader.is_knockout_round?( line )
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
|
95
|
-
def test_is_knockout_round_de
|
96
|
-
SportDb.lang.lang = 'de'
|
97
|
-
|
98
|
-
lines = [
|
99
|
-
'(1) Achtelfinale // Di+Mi 14.+15. & 21.+22. Feb 2012',
|
100
|
-
'(2) Achtelfinale Rückspiele // Di+Mi 6.+7. & 13.+14. März 2012',
|
101
|
-
'(3) Viertelfinale // Di+Mi 27.+28. März 2012',
|
102
|
-
'(4) Viertelfinale Rückspiele // Di+Mi 3.+4. April 2012',
|
103
|
-
'(5) Halbfinale // Di+Mi 17.+18. April 2012',
|
104
|
-
'(6) Halbfinale Rückspiele // Di+Mi 24.+25. April 2012',
|
105
|
-
'(7) Finale // Sa 19. Mai 2012'
|
106
|
-
]
|
107
|
-
|
108
|
-
reader = Reader.new
|
109
|
-
|
110
|
-
lines.each do |line|
|
111
|
-
assert_equal true, reader.is_knockout_round?( line )
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
private
|
116
|
-
#######################
|
117
|
-
# private helpers
|
118
|
-
|
119
|
-
class Reader
|
120
|
-
include LogUtils::Logging # add logger
|
121
|
-
include SportDb::FixtureHelpers
|
122
|
-
end
|
123
|
-
|
124
|
-
end # class TestUtils
|