Sha256: 758c0ba7c23fc150ee10dd66d081f425d4d3c6fc80f5c74d2c14dea0a1ef55f9

Contents?: true

Size: 1.44 KB

Versions: 19

Compression:

Stored size: 1.44 KB

Contents

# encoding: utf-8

require 'helper'

class TestScores < MiniTest::Unit::TestCase


  def test_scores
    assert_equal [10,0], parse_scores( '10:0' )
    assert_equal [1,22], parse_scores( '1:22' )
    assert_equal [1,22], parse_scores( '1-22' )

    assert_equal [], parse_scores( '1-222' )   # do not support three digits
    assert_equal [], parse_scores( '111-0' )   # do not support three digits
    assert_equal [], parse_scores( '1:222' )   # do not support three digits
    assert_equal [], parse_scores( '111:0' )   # do not support three digits

    ## penality only
    assert_equal [nil,nil,nil,nil,3,4], parse_scores( '3-4iE' )
    assert_equal [nil,nil,nil,nil,3,4], parse_scores( '3:4iE' )

    ## extra time only - allow ?? why not ?? only allow penalty w/ missing extra time?
    ## todo/fix: issue warning or error in parser!!!
    assert_equal [nil,nil,3,4], parse_scores( '3-4nV' )
    assert_equal [nil,nil,3,4], parse_scores( '3:4nV' )

    assert_equal [1,1,3,4], parse_scores( '3:4nV 1:1' )
    assert_equal [1,1,3,4], parse_scores( '1:1 3:4nV' )

    assert_equal [1,1,nil,nil,3,4], parse_scores( '3:4iE 1:1' )
    assert_equal [1,1,nil,nil,3,4], parse_scores( '1:1 3:4iE' )
  end

private
  class Reader
    include LogUtils::Logging      # add logger
    include SportDb::FixtureHelpers
  end

  def parse_scores( line )
     reader = Reader.new
     reader.find_scores!( line )
  end

end # class TestScores

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
sportdb-1.8.16 test/test_scores.rb
sportdb-1.8.15 test/test_scores.rb
sportdb-1.8.14 test/test_scores.rb
sportdb-1.8.13 test/test_scores.rb
sportdb-1.8.12 test/test_scores.rb
sportdb-1.8.11 test/test_scores.rb
sportdb-1.8.10 test/test_scores.rb
sportdb-1.8.9 test/test_scores.rb
sportdb-1.8.8 test/test_scores.rb
sportdb-1.8.7 test/test_scores.rb
sportdb-1.8.6 test/test_scores.rb
sportdb-1.8.5 test/test_scores.rb
sportdb-1.8.3 test/test_scores.rb
sportdb-1.8.2 test/test_scores.rb
sportdb-1.8.1 test/test_scores.rb
sportdb-1.8.0 test/test_scores.rb
sportdb-1.7.9 test/test_scores.rb
sportdb-1.7.8 test/test_scores.rb
sportdb-1.7.7 test/test_scores.rb