Sha256: fff187095314bf5f38aeef499323c1c93b22824fb3074c5938a55ff22153631a

Contents?: true

Size: 1.91 KB

Versions: 11

Compression:

Stored size: 1.91 KB

Contents

# encoding: utf-8

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


require 'helper'


class TestNameHelper < MiniTest::Test

  include SportDb::NameHelper


  def test_strip_norm    ## strip (remove) non-norm characters e.g. ()'- etc.
    [['Estudiantes (LP)',            'Estudiantes LP'],
     ['Central Córdoba (SdE)',       'Central Córdoba SdE'],
     ['Saint Patrick’s Athletic FC', 'Saint Patricks Athletic FC'],
     ['Myllykosken Pallo −47',       'Myllykosken Pallo 47'],
    ].each do |rec|
       assert_equal rec[1], strip_norm( rec[0] )
    end
  end

  def test_strip_year
    [['A (1911-1912)',              'A'],
     ['B (1911-1912, 1913-1915)',   'B'],
     ['C (1911-___)',               'C'],
     ['D (1911-???)',               'D'],
     ['FC Linz (1946-2001, 2013-)', 'FC Linz'],
     ['Admira Wien (-????)',        'Admira Wien'],
     ['Admira Wien (-____)',        'Admira Wien'],
    ].each do |rec|
      assert_equal rec[1], strip_year( rec[0] )
    end
  end

  def test_strip_lang
    [['Bayern Munich [en]', 'Bayern Munich'],
    ].each do |rec|
      assert_equal rec[1], strip_lang( rec[0] )
    end
  end


  def test_variants
    ## hungarian
    assert_equal ['Raba ETO Gyor'],                   variants( 'Rába ETO Győr' )
    assert_equal ['Raba ETO Gyor', 'Rába ETO Gyoer'], variants( 'Rába ETO Györ' )

    ## romanian
    assert_equal ['Targu Mures'], variants( 'Târgu Mureș' )
    assert_equal ['Targu Mures'], variants( 'Târgu Mureş' )
  end


=begin
### fix: move to ClubReader!!!!! not for general use
  def test_wiki
    assert_equal 'FC Wacker Innsbruck',   strip_wiki( 'FC Wacker Innsbruck (2002)' )
    assert_equal 'SK Austria Klagenfurt', strip_wiki( 'SK Austria Klagenfurt (2007)' )

    assert_equal 'Willem II',  strip_wiki( 'Willem II (football club)' )
  end
=end
end # class TestNameHelper

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sportdb-formats-1.1.3 test/test_name_helper.rb
sportdb-formats-1.1.2 test/test_name_helper.rb
sportdb-formats-1.1.1 test/test_name_helper.rb
sportdb-formats-1.1.0 test/test_name_helper.rb
sportdb-formats-1.0.6 test/test_name_helper.rb
sportdb-formats-1.0.5 test/test_name_helper.rb
sportdb-formats-1.0.4 test/test_name_helper.rb
sportdb-formats-1.0.3 test/test_name_helper.rb
sportdb-formats-1.0.2 test/test_name_helper.rb
sportdb-formats-1.0.1 test/test_name_helper.rb
sportdb-formats-1.0.0 test/test_name_helper.rb