Sha256: ec25fefb55e846fb75b8dfcd4f0ad6b7399c80e91f4998f9ef0353858ae734a8
Contents?: true
Size: 909 Bytes
Versions: 1
Compression:
Stored size: 909 Bytes
Contents
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper')) class TestResult < Test::Unit::TestCase def setup @result = OmniCat::Result.new @score1 = OmniCat::Score.new(key: 'pos', value: 0.43) @score2 = OmniCat::Score.new(key: 'net', value: 0.76) @score3 = OmniCat::Score.new(key: 'neg', value: 0.11) end def test_add_score @result.add_score(@score1) assert_equal(@score1, @result.scores[@score1.key]) end def test_top_score @result.add_score(@score1) @result.add_score(@score2) @result.add_score(@score3) assert_equal(@score2, @result.top_score) end def test_percentage @result.add_score(@score1) @result.add_score(@score2) @result.add_score(@score3) @result.calculate_percentages assert_equal(33, @score1.percentage) assert_equal(58, @score2.percentage) assert_equal(8, @score3.percentage) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omnicat-0.3.0 | test/unit/result_test.rb |