class Test::Unit::TestAssertNotInDelta

Public Instance Methods

test_fail() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1726
def test_fail
  check_fail("<1.4> -/+ <0.11> was expected to not include\n" +
              "<1.5>.\n" +
              "\n" +
              "Relation:\n" +
              "<" +
              "<1.4>-<0.11>[#{1.4 - 0.11}] <= " +
              "<1.5> <= " +
              "<1.4>+<0.11>[#{1.4 + 0.11}]" +
              ">") do
    assert_not_in_delta(1.4, 1.5, 0.11)
  end
end
test_fail_because_negaitve_delta() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1780
def test_fail_because_negaitve_delta
  check_fail("The delta should not be negative.\n" +
              "<-0.11> was expected to be\n>=\n<0.0>.") do
    assert_not_in_delta(0.5, 0.4, -0.11, "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 1769
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_not_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 1754
def test_fail_with_message
  check_fail("message.\n" +
              "<0.5> -/+ <0.11> was expected to not include\n" +
              "<0.4>.\n" +
              "\n" +
              "Relation:\n" +
              "<" +
              "<0.5>-<0.11>[0.39] <= " +
              "<0.4> <= " +
              "<0.5>+<0.11>[0.61]" +
              ">") do
    assert_not_in_delta(0.5, 0.4, 0.11, "message")
  end
end
test_fail_without_delta() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1740
def test_fail_without_delta
  check_fail("<1.402> -/+ <0.001> was expected to not include\n" +
              "<1.4021>.\n" +
              "\n" +
              "Relation:\n" +
              "<" +
              "<1.402>-<0.001>[#{1.402 - 0.001}] <= " +
              "<1.4021> <= " +
              "<1.402>+<0.001>[#{1.402 + 0.001}]" +
              ">") do
    assert_not_in_delta(1.402, 1.4021)
  end
end
test_pass() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1692
def test_pass
  check_nothing_fails do
    assert_not_in_delta(1.42, 1.44, 0.01)
  end
end
test_pass_float_like_object() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1710
def test_pass_float_like_object
  check_nothing_fails do
    float_thing = Object.new
    def float_thing.to_f
      0.2
    end
    assert_not_in_delta(0.1, float_thing, 0.09)
  end
end
test_pass_string_epxected() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1720
def test_pass_string_epxected
  check_nothing_fails do
    assert_not_in_delta("0.5", 0.4, 0.09)
  end
end
test_pass_with_message() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1704
def test_pass_with_message
  check_nothing_fails do
    assert_not_in_delta(0.5, 0.4, 0.09, "message")
  end
end
test_pass_without_delta() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1698
def test_pass_without_delta
  check_nothing_fails do
    assert_not_in_delta(1.402, 1.404)
  end
end