Sha256: ceb4136e98e5363e81241c863fe382b5a73e933c4e11385e3929f2cb1b60b3f3

Contents?: true

Size: 432 Bytes

Versions: 1

Compression:

Stored size: 432 Bytes

Contents

require 'test/unit'

require '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

1 entries across 1 versions & 1 rubygems

Version Path
eymiha_math-0.1.1 test/tc_fraction.rb