sportdb-formats 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,9 +9,12 @@ require 'helper'
9
9
 
10
10
  class TestPackageMatch < MiniTest::Test
11
11
 
12
- CLUBS_DIR = '../../../openfootball/clubs' ## source repo directory path
13
- LEAGUES_DIR = '../../../openfootball/leagues'
14
- AUSTRIA_DIR = '../../../openfootball/austria'
12
+ CLUBS_DIR = '../../../openfootball/clubs' ## source repo directory path
13
+ LEAGUES_DIR = '../../../openfootball/leagues'
14
+ AUSTRIA_DIR = '../../../openfootball/austria'
15
+
16
+ AUSTRIA_CSV_DIR = '../../../footballcsv/austria'
17
+
15
18
 
16
19
  def test_find
17
20
  datafiles = SportDb::Package.find_clubs( CLUBS_DIR )
@@ -25,6 +28,27 @@ class TestPackageMatch < MiniTest::Test
25
28
 
26
29
  datafiles = SportDb::Package.find_conf( AUSTRIA_DIR )
27
30
  pp datafiles
31
+
32
+ datafiles = SportDb::Package.find_match( AUSTRIA_DIR )
33
+ puts
34
+ puts "== find_match (in #{AUSTRIA_DIR}) - found #{datafiles.size}:"
35
+ pp datafiles
36
+
37
+ datafiles = SportDb::Package.find_match( AUSTRIA_CSV_DIR )
38
+ puts
39
+ puts "== find_match (in #{AUSTRIA_CSV_DIR}) - found #{datafiles.size}:"
40
+ pp datafiles
41
+
42
+
43
+ datafiles = SportDb::Package.find_match( AUSTRIA_DIR, format: 'csv' )
44
+ puts
45
+ puts "== find_match+csv (in #{AUSTRIA_DIR}) - found #{datafiles.size}:"
46
+ pp datafiles
47
+
48
+ datafiles = SportDb::Package.find_match( AUSTRIA_CSV_DIR, format: 'csv' )
49
+ puts
50
+ puts "== find_match+csv (in #{AUSTRIA_CSV_DIR}) - found #{datafiles.size}:"
51
+ pp datafiles
28
52
  end
29
53
 
30
54
 
@@ -12,9 +12,9 @@ class TestScores < MiniTest::Test
12
12
  def test_de
13
13
  ScoreFormats.lang = :de
14
14
  data = [
15
- [ '10:0', [nil,nil,10,0]],
16
- [ '1:22', [nil,nil,1,22]],
17
- [ '1-22', [nil,nil,1,22]],
15
+ [ '10:0', [nil,nil, 10,0]],
16
+ [ '1:22', [nil,nil, 1,22]],
17
+ [ '1-22', [nil,nil, 1,22]],
18
18
 
19
19
  ## do not support three digits for now - why? why not?
20
20
  [ '1:222', []],
@@ -22,23 +22,32 @@ class TestScores < MiniTest::Test
22
22
  [ '1-222', []],
23
23
  [ '111-0', []],
24
24
 
25
- [ '2:2 (1:1, 1:0) n.V. 5:1 i.E.', [1,0,1,1,2,2,5,1]],
26
- [ '2:2 (1:1, 1:0) n.V.', [1,0,1,1,2,2]],
27
- [ '2:2 (1:1, ) n.V. 5:1 i.E.', [nil,nil,1,1,2,2,5,1]],
28
- [ '2:2 (1:1, ) n.V.', [nil,nil,1,1,2,2]],
29
-
30
- [ '2:2 (1:1) n.V. 5:1 i.E.', [nil,nil,1,1,2,2,5,1]],
31
- [ '2:2 (1:1) n.V.', [nil,nil,1,1,2,2]],
32
-
33
- [ '2-2 (1-1, 1-0) n.V. 5-1 i.E.', [1,0,1,1,2,2,5,1]],
34
- [ '2-2 (1-1, 1-0) n.V.', [1,0,1,1,2,2]],
35
- [ '2-2 (1-1, ) n.V. 5-1 i.E.', [nil,nil,1,1,2,2,5,1]],
36
- [ '2-2 (1-1, ) n.V.', [nil,nil,1,1,2,2]],
37
-
38
- [ '2 : 2 ( 1 : 1 , 1 : 0 ) n.V. 5 : 1 i.E.', [1,0,1,1,2,2,5,1]],
39
- [ '2 : 2 ( 1 : 1 , 1 : 0 ) n.V.', [1,0,1,1,2,2]],
40
- [ '2 : 2 ( 1 : 1 , ) n.V. 5 : 1 i.E.', [nil,nil,1,1,2,2,5,1]],
41
- [ '2 : 2 ( 1 : 1 , ) n.V.', [nil,nil,1,1,2,2]],
25
+ [ '2:2 (1:1, 1:0) n.V. 5:1 i.E.', [1,0, 1,1, 2,2, 5,1]],
26
+ [ '2:2 (1:1, 1:0) n.V.', [1,0, 1,1, 2,2]],
27
+ [ '2:2 (1:1, ) n.V. 5:1 i.E.', [nil,nil, 1,1, 2,2, 5,1]],
28
+ [ '2:2 (1:1, ) n.V.', [nil,nil, 1,1, 2,2]],
29
+
30
+ [ '2:2 (1:1) n.V. 5:1 i.E.', [nil,nil, 1,1, 2,2, 5,1]],
31
+ [ '2:2 (1:1) n.V.', [nil,nil, 1,1, 2,2]],
32
+
33
+ [ '2-2 (1-1, 1-0) n.V. 5-1 i.E.', [1,0, 1,1, 2,2, 5,1]],
34
+ [ '2-2 (1-1, 1-0) n.V.', [1,0, 1,1, 2,2]],
35
+ [ '2-2 (1-1, ) n.V. 5-1 i.E.', [nil,nil, 1,1, 2,2, 5,1]],
36
+ [ '2-2 (1-1, ) n.V.', [nil,nil, 1,1, 2,2]],
37
+
38
+ [ '2 : 2 ( 1 : 1 , 1 : 0 ) n.V. 5 : 1 i.E.', [1,0, 1,1, 2,2, 5,1]],
39
+ [ '2 : 2 ( 1 : 1 , 1 : 0 ) n.V.', [1,0, 1,1, 2,2]],
40
+ [ '2 : 2 ( 1 : 1 , ) n.V. 5 : 1 i.E.', [nil,nil, 1,1, 2,2, 5,1]],
41
+ [ '2 : 2 ( 1 : 1 , ) n.V.', [nil,nil, 1,1, 2,2]],
42
+
43
+ ## alternate format
44
+ ['i.E. 2:4, n.V. 3:3 (1:1, 1:0)', [1,0, 1,1, 3,3, 2,4]],
45
+ ['iE 2:4 nV 3:3 (1:1, 1:0)', [1,0, 1,1, 3,3, 2,4]],
46
+ ['i.E. 2:4 n.V. 3:3 (1:1, 1:0)', [1,0, 1,1, 3,3, 2,4]],
47
+ ['i.E. 2:4, n.V. 3:3 (1:1)', [nil, nil, 1,1, 3,3, 2,4]],
48
+ ['i.E. 2:4 n.V. 3:3 (1:1)', [nil, nil, 1,1, 3,3, 2,4]],
49
+ ['n.V. 3:2 (2:2, 1:2)', [1,2, 2,2, 3,2]],
50
+ ['n.V. 3:2 (2:2)', [nil, nil, 2,2, 3,2]],
42
51
  ]
43
52
 
44
53
  assert_score( data )
@@ -48,9 +57,9 @@ class TestScores < MiniTest::Test
48
57
  ScoreFormats.lang = :en
49
58
 
50
59
  data = [
51
- [ '1-22', [nil,nil,1,22]],
52
- [ '1x22', [nil,nil,1,22]],
53
- [ '1X22', [nil,nil,1,22]],
60
+ [ '1-22', [nil,nil, 1, 22]],
61
+ [ '1x22', [nil,nil, 1, 22]],
62
+ [ '1X22', [nil,nil, 1,22]],
54
63
 
55
64
  ## do not support three digits for now - why? why not?
56
65
  [ '1-222', []],
@@ -63,39 +72,39 @@ class TestScores < MiniTest::Test
63
72
  [ '2:1 (1:1)', []],
64
73
 
65
74
 
66
- [ '2-1 (1-1)', [1,1,2,1]],
67
- [ '2x1 (1x1)', [1,1,2,1]],
68
- [ '2X1 (1X1)', [1,1,2,1]],
75
+ [ '2-1 (1-1)', [1,1, 2,1]],
76
+ [ '2x1 (1x1)', [1,1, 2,1]],
77
+ [ '2X1 (1X1)', [1,1, 2,1]],
69
78
 
70
- [ '2-1 a.e.t. (1-1, 0-0)', [0,0,1,1,2,1]],
71
- [ '2-1aet (1-1, 0-0)', [0,0,1,1,2,1]],
72
- [ '2-1 A.E.T. (1-1, 0-0)', [0,0,1,1,2,1]],
73
- [ '2-1AET (1-1, 0-0)', [0,0,1,1,2,1]],
79
+ [ '2-1 a.e.t. (1-1, 0-0)', [0,0, 1,1, 2,1]],
80
+ [ '2-1aet (1-1, 0-0)', [0,0, 1,1, 2,1]],
81
+ [ '2-1 A.E.T. (1-1, 0-0)', [0,0, 1,1, 2,1]],
82
+ [ '2-1AET (1-1, 0-0)', [0,0, 1,1, 2,1]],
74
83
 
75
- [ '3-4 pen. 2-2 a.e.t. (1-1, 1-1)', [1,1,1,1,2,2,3,4]],
76
- [ '3-4 pen 2-2 a.e.t. (1-1, 1-1)', [1,1,1,1,2,2,3,4]],
77
- [ '3-4 pen 2-2 a.e.t. (1-1, 1-1)', [1,1,1,1,2,2,3,4]],
78
- [ '3-4p 2-2aet (1-1, 1-1)', [1,1,1,1,2,2,3,4]],
79
- [ '3-4PSO 2-2AET (1-1, 1-1)', [1,1,1,1,2,2,3,4]],
84
+ [ '3-4 pen. 2-2 a.e.t. (1-1, 1-1)', [1,1, 1,1, 2,2, 3,4]],
85
+ [ '3-4 pen 2-2 a.e.t. (1-1, 1-1)', [1,1, 1,1, 2,2, 3,4]],
86
+ [ '3-4 pen 2-2 a.e.t. (1-1, 1-1)', [1,1, 1,1, 2,2, 3,4]],
87
+ [ '3-4p 2-2aet (1-1, 1-1)', [1,1, 1,1, 2,2, 3,4]],
88
+ [ '3-4PSO 2-2AET (1-1, 1-1)', [1,1, 1,1, 2,2, 3,4]],
80
89
 
81
- [ '4-3 pen. 1-0 a.e.t. (1-0, )', [nil,nil,1,0,1,0,4,3]],
82
- [ '3-4 pen. 2-1 a.e.t. (2-1, )', [nil,nil,2,1,2,1,3,4]],
83
- [ '4-1 a.e.t. (3-1, )', [nil,nil,3,1,4,1]],
84
- [ '3-4aet (1-1,)', [nil,nil,1,1,3,4]],
85
- [ '3-4 a.e.t. (1-1,)', [nil,nil,1,1,3,4]],
90
+ [ '4-3 pen. 1-0 a.e.t. (1-0, )', [nil,nil, 1,0, 1,0, 4,3]],
91
+ [ '3-4 pen. 2-1 a.e.t. (2-1, )', [nil,nil, 2,1, 2,1, 3,4]],
92
+ [ '4-1 a.e.t. (3-1, )', [nil,nil, 3,1, 4,1]],
93
+ [ '3-4aet (1-1,)', [nil,nil, 1,1, 3,4]],
94
+ [ '3-4 a.e.t. (1-1,)', [nil,nil, 1,1, 3,4]],
86
95
 
87
- [ '4-3 pen. 1-0 a.e.t. (1-0)', [nil,nil,1,0,1,0,4,3]],
88
- [ '3-4 pen. 2-1 a.e.t. (2-1)', [nil,nil,2,1,2,1,3,4]],
89
- [ '4-1 a.e.t. (3-1)', [nil,nil,3,1,4,1]],
90
- [ '3-4aet (1-1)', [nil,nil,1,1,3,4]],
91
- [ '3-4 a.e.t. (1-1)', [nil,nil,1,1,3,4]],
96
+ [ '4-3 pen. 1-0 a.e.t. (1-0)', [nil,nil, 1,0, 1,0, 4,3]],
97
+ [ '3-4 pen. 2-1 a.e.t. (2-1)', [nil,nil, 2,1, 2,1, 3,4]],
98
+ [ '4-1 a.e.t. (3-1)', [nil,nil, 3,1, 4,1]],
99
+ [ '3-4aet (1-1)', [nil,nil, 1,1, 3,4]],
100
+ [ '3-4 a.e.t. (1-1)', [nil,nil, 1,1, 3,4]],
92
101
 
93
- [ '3-1 pen (1-1)', [nil,nil,1,1, nil, nil, 3,1]],
102
+ [ '3-1 pen (1-1)', [nil,nil, 1,1, nil, nil, 3,1]],
94
103
 
95
104
  ## try with more "liberal" spaces
96
- [ '2 - 1 ( 1 - 1 )', [1,1,2,1]],
97
- [ '2 - 1 a.e.t. ( 1 - 1 , 0 - 0 )', [0,0,1,1,2,1]],
98
- [ '4 - 1 a.e.t. ( 3 - 1, )', [nil,nil,3,1,4,1]],
105
+ [ '2 - 1 ( 1 - 1 )', [1,1, 2,1]],
106
+ [ '2 - 1 a.e.t. ( 1 - 1 , 0 - 0 )', [0,0, 1,1, 2,1]],
107
+ [ '4 - 1 a.e.t. ( 3 - 1, )', [nil,nil, 3,1, 4,1]],
99
108
  ]
100
109
 
101
110
  assert_score( data )
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportdb-formats
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-12 00:00:00.000000000 Z
11
+ date: 2020-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: alphabets
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.0.0
33
+ version: 1.0.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 1.0.0
40
+ version: 1.0.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: csvreader
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +136,7 @@ files:
136
136
  - lib/sportdb/formats/match/mapper_teams.rb
137
137
  - lib/sportdb/formats/match/match_parser.rb
138
138
  - lib/sportdb/formats/match/match_parser_auto_conf.rb
139
+ - lib/sportdb/formats/match/match_parser_csv.rb
139
140
  - lib/sportdb/formats/name_helper.rb
140
141
  - lib/sportdb/formats/outline_reader.rb
141
142
  - lib/sportdb/formats/package.rb
@@ -168,8 +169,11 @@ files:
168
169
  - test/test_conf.rb
169
170
  - test/test_country_index.rb
170
171
  - test/test_country_reader.rb
172
+ - test/test_csv_match_parser.rb
173
+ - test/test_csv_match_parser_utils.rb
171
174
  - test/test_csv_reader.rb
172
175
  - test/test_datafile.rb
176
+ - test/test_datafile_package.rb
173
177
  - test/test_goals.rb
174
178
  - test/test_league_index.rb
175
179
  - test/test_league_outline_reader.rb