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