test/tc_rectify.rb in eymiha_math-0.1.0 vs test/tc_rectify.rb in eymiha_math-0.1.1
- old
+ new
@@ -23,7 +23,17 @@
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