require 'test/unit' require 'rectify' class TC_rectify < Test::Unit::TestCase def test_wrap_rectify assert(0.5.wrap_rectify(1) == 0.5) assert(5.5.wrap_rectify(1) =~ 0.5) assert(-7.25.wrap_rectify(2) =~ 0.75) assert(-7.25.wrap_rectify(2,0.5) =~ 1.75) assert(-7.25.wrap_rectify(0.5,2) =~ 1.75) assert(2.wrap_rectify(0.5,2) == 0.5) assert(0.5.wrap_rectify(0.5,2) == 0.5) assert(0.5.wrap_rectify(0,0) == 0) end def test_cut_rectify assert(0.5.cut_rectify(1) == 0.5) assert(5.5.cut_rectify(1) == 1) assert(-7.25.cut_rectify(2) == 0) assert(-7.25.cut_rectify(2,0.5) == 0.5) assert(-7.25.cut_rectify(0.5,2) == 0.5) assert(2.cut_rectify(0.5,2) == 2) assert(0.5.cut_rectify(0.5,2) == 0.5) assert(0.5.cut_rectify(0,0) == 0) end end