class Test::Unit::TestAssertInDelta
Public Instance Methods
test_fail_because_negaitve_delta()
click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1667 def test_fail_because_negaitve_delta check_fail("The delta should not be negative.\n" + "<-0.1> was expected to be\n>=\n<0.0>.") do assert_in_delta(0.5, 0.4, -0.1, "message") end end
test_fail_because_not_float_like_object()
click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1656 def test_fail_because_not_float_like_object object = Object.new inspected_object = AssertionMessage.convert(object) check_fail("The arguments must respond to to_f; " + "the first float did not.\n" + "<#{inspected_object}>.respond_to?(:to_f) expected\n" + "(Class: <Object>)") do assert_in_delta(object, 0.4, 0.1) end end
test_fail_with_message()
click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1645 def test_fail_with_message check_fail("message.\n" + "<0.5> -/+ <0.05> was expected to include\n" + "<0.4>.\n" + "\n" + "Relation:\n" + "<<0.4> < <0.5>-<0.05>[0.45] <= <0.5>+<0.05>[0.55]>") do assert_in_delta(0.5, 0.4, 0.05, "message") end end
test_fail_without_delta()
click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1674 def test_fail_without_delta check_fail("<1.402> -/+ <0.001> was expected to include\n" + "<1.404>.\n" + "\n" + "Relation:\n" + "<" + "<1.402>-<0.001>[#{1.402 - 0.001}] <= " + "<1.402>+<0.001>[#{1.402 + 0.001}] < " + "<1.404>" + ">") do assert_in_delta(1.402, 1.404) end end
test_pass()
click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1611 def test_pass check_nothing_fails do assert_in_delta(1.4, 1.4, 0) end end
test_pass_float_like_object()
click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1629 def test_pass_float_like_object check_nothing_fails do float_thing = Object.new def float_thing.to_f 0.2 end assert_in_delta(0.1, float_thing, 0.1) end end
test_pass_string_expected()
click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1639 def test_pass_string_expected check_nothing_fails do assert_in_delta("0.5", 0.4, 0.1) end end
test_pass_with_message()
click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1623 def test_pass_with_message check_nothing_fails do assert_in_delta(0.5, 0.4, 0.1, "message") end end
test_pass_without_delta()
click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1617 def test_pass_without_delta check_nothing_fails do assert_in_delta(1.401, 1.402) end end