sportdb-formats 1.0.3 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,41 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_match_auto_relegation.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+
11
+ class TestMatchAutoRelegation < MiniTest::Test
12
+
13
+ def test_rel
14
+ txt = <<TXT
15
+ Hinspiel
16
+ [31.5.]
17
+ SC Wiener Neustadt 0-2 SKN St. Pölten
18
+
19
+ Rückspiel
20
+ [3.6.]
21
+ SKN St. Pölten 1-1 SC Wiener Neustadt
22
+ TXT
23
+
24
+ start = Date.new( 2017, 7, 1 )
25
+ SportDb::Import.config.lang = 'de'
26
+
27
+ teams, rounds, groups, round_defs, group_defs = SportDb::AutoConfParser.parse( txt, start: start )
28
+
29
+ puts "teams:"
30
+ pp teams
31
+ puts "rounds:"
32
+ pp rounds
33
+ puts "groups:"
34
+ pp groups
35
+ puts "round defs:"
36
+ pp round_defs
37
+ puts "group defs:"
38
+ pp group_defs
39
+ end
40
+
41
+ end # class TestMatchAutoRelegation
@@ -9,9 +9,27 @@ require 'helper'
9
9
 
10
10
  class TestRegex < MiniTest::Test
11
11
 
12
+ HEADER_SEP_RE = SportDb::MatchParser::HEADER_SEP_RE
13
+
14
+ def test_header_sep
15
+ assert_equal ['Round', 'Fr+Sa Dec 11+12'], 'Round // Fr+Sa Dec 11+12'.split( HEADER_SEP_RE )
16
+ assert_equal ['Round 11', 'Fr+Sa Dec 11+12'], 'Round 11 /// Fr+Sa Dec 11+12'.split( HEADER_SEP_RE )
17
+ assert_equal ['Round 11', 'Fr+Sa Dec 11+12'], 'Round 11 -- Fr+Sa Dec 11+12'.split( HEADER_SEP_RE )
18
+ assert_equal ['Round 11', 'Fr+Sa Dec 11+12'], 'Round 11 --- Fr+Sa Dec 11+12'.split( HEADER_SEP_RE )
19
+ assert_equal ['Round 11', 'Fr+Sa Dec 11+12'], 'Round 11 ++ Fr+Sa Dec 11+12'.split( HEADER_SEP_RE )
20
+ assert_equal ['Round 11', 'Fr+Sa Dec 11+12'], 'Round 11 +++ Fr+Sa Dec 11+12'.split( HEADER_SEP_RE )
21
+ assert_equal ['Round 11', 'Fr+Sa Dec 11+12'], 'Round 11 || Fr+Sa Dec 11+12'.split( HEADER_SEP_RE )
22
+
23
+ assert_equal ['Final - Leg 1'], 'Final - Leg 1'.split( HEADER_SEP_RE )
24
+ assert_equal ['Final | Leg 1'], 'Final | Leg 1'.split( HEADER_SEP_RE )
25
+ assert_equal ['Final / Leg 1'], 'Final / Leg 1'.split( HEADER_SEP_RE )
26
+ assert_equal ['Final, Leg 1'], 'Final, Leg 1'.split( HEADER_SEP_RE )
27
+ end
28
+
29
+
12
30
  ADDR_MARKER_RE = SportDb::Import::ClubReader::ADDR_MARKER_RE
13
31
  B_TEAM_MARKER_RE = SportDb::Import::ClubReader::B_TEAM_MARKER_RE
14
-
32
+
15
33
  def test_addr
16
34
  assert '~ Wien' =~ ADDR_MARKER_RE
17
35
  assert 'Wien ~' =~ ADDR_MARKER_RE
@@ -22,13 +40,13 @@ class TestRegex < MiniTest::Test
22
40
  assert 'Fischhofgasse 12 /// 1100 Wien' =~ ADDR_MARKER_RE
23
41
 
24
42
  assert_nil 'Fischhofgasse 12 + 1100 Wien' =~ ADDR_MARKER_RE
25
- assert_nil 'Fischhofgasse 12++1100 Wien' =~ ADDR_MARKER_RE
43
+ assert_nil 'Fischhofgasse 12++1100 Wien' =~ ADDR_MARKER_RE ## todo/fix: make it a match!!! why? why not?
26
44
  assert_nil 'Fischhofgasse 12 / 1100 Wien' =~ ADDR_MARKER_RE
27
- assert_nil 'Fischhofgasse 12//1100 Wien' =~ ADDR_MARKER_RE
28
-
45
+ assert_nil 'Fischhofgasse 12//1100 Wien' =~ ADDR_MARKER_RE ## todo/fix: make it a match!!! why? why not?
46
+
29
47
  assert_nil 'Atlanta United FC, 2017, Atlanta › Georgia' =~ ADDR_MARKER_RE
30
48
  end
31
-
49
+
32
50
  def test_b_team
33
51
  assert 'b) Rapid Wien II' =~ B_TEAM_MARKER_RE
34
52
  assert '(b) Rapid Wien II' =~ B_TEAM_MARKER_RE
@@ -38,12 +56,12 @@ class TestRegex < MiniTest::Test
38
56
  assert '(ii.) Rapid Wien II' =~ B_TEAM_MARKER_RE
39
57
  assert '2) Rapid Wien II' =~ B_TEAM_MARKER_RE
40
58
  assert '(2) Rapid Wien II' =~ B_TEAM_MARKER_RE
41
-
59
+
42
60
  assert_nil '(3) Rapid Wien II' =~ B_TEAM_MARKER_RE
43
61
  assert_nil '(iii) Rapid Wien II' =~ B_TEAM_MARKER_RE
44
62
  assert_nil 'iii) Rapid Wien II' =~ B_TEAM_MARKER_RE
45
63
  assert_nil 'c) Rapid Wien II' =~ B_TEAM_MARKER_RE
46
64
  assert_nil '(c) Rapid Wien II' =~ B_TEAM_MARKER_RE
47
65
  end
48
-
66
+
49
67
  end # class TestRegex
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.3
4
+ version: 1.1.1
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-16 00:00:00.000000000 Z
11
+ date: 2020-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: alphabets
@@ -182,6 +182,7 @@ files:
182
182
  - test/test_match_auto.rb
183
183
  - test/test_match_auto_champs.rb
184
184
  - test/test_match_auto_euro.rb
185
+ - test/test_match_auto_relegation.rb
185
186
  - test/test_match_auto_worldcup.rb
186
187
  - test/test_match_champs.rb
187
188
  - test/test_match_eng.rb