Sha256: df06d824de6e0850ebd91b02a254d6018be4d9c90e59403c423b35044aaef76b

Contents?: true

Size: 1.91 KB

Versions: 10

Compression:

Stored size: 1.91 KB

Contents

# encoding: utf-8

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


require 'helper'

class TestDatafileMatch < MiniTest::Test

  def match_clubs( txt )      Datafile.match_clubs( txt ); end
  def match_clubs_wiki( txt ) Datafile.match_clubs_wiki( txt ); end
  def match_leagues( txt )    Datafile.match_leagues( txt ); end
  def match_conf( txt )       Datafile.match_conf( txt ); end


  CLUBS_TXT = [ ## with country code
               'de.clubs.txt',
               'deutschland/de.clubs.txt',
                ## without country code
               'europe/de-deutschland/clubs.txt',
               'de-deutschland/clubs.txt',
               'deutschland/clubs.txt',
               'clubs.txt' ]

  CLUBS_WIKI_TXT = [ ## with country code
                     'de.clubs.wiki.txt',
                     'deutschland/de.clubs.wiki.txt',
                     ## without country code
                     'europe/de-deutschland/clubs.wiki.txt',
                     'de-deutschland/clubs.wiki.txt',
                     'deutschland/clubs.wiki.txt',
                     'clubs.wiki.txt' ]

  LEAGUES_TXT = [ 'europe/england/leagues.txt',
                  'england/leagues.txt',
                  'leagues.txt' ]

  CONF_TXT = [ 'austria/archives/2000s/2001-02/.conf.txt',
               'austria/2019-20/.conf.txt',
               '.conf.txt' ]


  def test_match_clubs
    CLUBS_TXT.each { |txt| assert match_clubs( txt ) }

    CLUBS_WIKI_TXT.each { |txt| assert !match_clubs( txt ) }
  end

  def test_match_clubs_wiki
    CLUBS_WIKI_TXT.each { |txt| assert match_clubs_wiki( txt ) }

    CLUBS_TXT.each { |txt| assert !match_clubs_wiki( txt ) }
  end

  def test_match_leagues
    LEAGUES_TXT.each { |txt| assert match_leagues( txt ) }
  end

  def test_match_conf
    CONF_TXT.each { |txt| assert match_conf( txt ) }
  end

end # class TestFindDatafileMatch

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
sportdb-formats-0.4.0 test/test_datafile_match.rb
sportdb-formats-0.3.0 test/test_datafile_match.rb
sportdb-formats-0.2.1 test/test_datafile_match.rb
sportdb-formats-0.2.0 test/test_datafile_match.rb
sportdb-formats-0.1.7 test/test_datafile_match.rb
sportdb-formats-0.1.6 test/test_datafile_match.rb
sportdb-formats-0.1.5 test/test_datafile_match.rb
sportdb-formats-0.1.4 test/test_datafile_match.rb
sportdb-formats-0.1.3 test/test_datafile_match.rb
sportdb-formats-0.1.2 test/test_datafile_match.rb