Sha256: d963804ea8a251af60c964703da87189236187f735db7524cf506a9fd850c717

Contents?: true

Size: 1.75 KB

Versions: 6

Compression:

Stored size: 1.75 KB

Contents

# encoding: utf-8

###
#  to run use
#     ruby -I ./lib -I ./test test/test_regex.rb


require 'helper'

class TestRegex < MiniTest::Test

  ADDR_MARKER_RE   = SportDb::Import::ClubReader::ADDR_MARKER_RE
  B_TEAM_MARKER_RE = SportDb::Import::ClubReader::B_TEAM_MARKER_RE
  
  def test_addr
    assert  '~ Wien' =~ ADDR_MARKER_RE
    assert  'Wien ~' =~ ADDR_MARKER_RE
    assert 'Fischhofgasse 12 ~ 1100 Wien'   =~ ADDR_MARKER_RE
    assert 'Fischhofgasse 12 ++ 1100 Wien'  =~ ADDR_MARKER_RE
    assert 'Fischhofgasse 12 +++ 1100 Wien' =~ ADDR_MARKER_RE
    assert 'Fischhofgasse 12 // 1100 Wien'  =~ ADDR_MARKER_RE
    assert 'Fischhofgasse 12 /// 1100 Wien' =~ ADDR_MARKER_RE

    assert_nil 'Fischhofgasse 12 + 1100 Wien' =~ ADDR_MARKER_RE
    assert_nil 'Fischhofgasse 12++1100 Wien' =~ ADDR_MARKER_RE
    assert_nil 'Fischhofgasse 12 / 1100 Wien' =~ ADDR_MARKER_RE
    assert_nil 'Fischhofgasse 12//1100 Wien' =~ ADDR_MARKER_RE
    
    assert_nil 'Atlanta United FC, 2017,  Atlanta   › Georgia' =~ ADDR_MARKER_RE
  end
  
  def test_b_team
    assert 'b)    Rapid Wien II' =~ B_TEAM_MARKER_RE
    assert '(b)   Rapid Wien II' =~ B_TEAM_MARKER_RE
    assert '(b.)  Rapid Wien II' =~ B_TEAM_MARKER_RE
    assert 'ii)   Rapid Wien II' =~ B_TEAM_MARKER_RE
    assert 'II)   Rapid Wien II' =~ B_TEAM_MARKER_RE
    assert '(ii.) Rapid Wien II' =~ B_TEAM_MARKER_RE
    assert '2)    Rapid Wien II' =~ B_TEAM_MARKER_RE
    assert '(2)   Rapid Wien II' =~ B_TEAM_MARKER_RE
 
    assert_nil '(3)   Rapid Wien II' =~ B_TEAM_MARKER_RE
    assert_nil '(iii) Rapid Wien II' =~ B_TEAM_MARKER_RE
    assert_nil 'iii)  Rapid Wien II' =~ B_TEAM_MARKER_RE
    assert_nil 'c)    Rapid Wien II' =~ B_TEAM_MARKER_RE
    assert_nil '(c)   Rapid Wien II' =~ B_TEAM_MARKER_RE
  end
  
end # class TestRegex

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sportdb-formats-1.0.6 test/test_regex.rb
sportdb-formats-1.0.5 test/test_regex.rb
sportdb-formats-1.0.4 test/test_regex.rb
sportdb-formats-1.0.3 test/test_regex.rb
sportdb-formats-1.0.2 test/test_regex.rb
sportdb-formats-1.0.1 test/test_regex.rb