Sha256: 1ff6c31fad099b29710fdd8ef8d459269b8af09851886ec4c19210ef9ea800ad
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
require 'test/unit' require 'eymiha/math/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 def test_at_most assert((-5..5).collect{|v| v.at_most(2)} == [-5,-4,-3,-2,-1,0,1,2,2,2,2]) end def test_at_least assert((-5..5).collect{|v| v.at_least(-1.5)} == [-1.5,-1.5,-1.5,-1.5,-1,0,1,2,3,4,5]) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
eymiha_math-1.0.1 | test/tc_rectify.rb |
eymiha_math-1.0.0 | test/tc_rectify.rb |