Sha256: 27bb45e3254248ba19a355cc09f41335dd07e3aae2f7172d5fca8c3d2b819d04

Contents?: true

Size: 444 Bytes

Versions: 2

Compression:

Stored size: 444 Bytes

Contents

require 'test/unit'

require 'eymiha/math/fraction'

class TC_fraction < Test::Unit::TestCase

  def test_with_fraction
    assert(2.31.with_fraction(4) == "2-1/4")
    assert(2.31.with_fraction(5) == "2-2/5")
    assert(2.31.with_fraction(6,' ') == "2 2/6")
  end
  
  def test_round_to_nearest
    assert(0.22.round_to_nearest(5) == 0.2)
    assert(0.22.round_to_nearest(10) == 0.2)
    assert(0.22.round_to_nearest(50) == 0.22)
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eymiha_math-1.0.0 test/tc_fraction.rb
eymiha_math-1.0.1 test/tc_fraction.rb