class Test::Unit::TestAssertNotInEpsilon

Public Instance Methods

test_fail() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1924
def test_fail
  check_fail("<10000> -/+ (<10000> * <0.1>)[1000.0] " +
              "was expected to not include\n" +
              "<9000>.\n" +
              "\n" +
              "Relation:\n" +
              "<" +
              "<10000>-(<10000>*<0.1>)[9000.0] <= " +
              "<9000> <= " +
              "<10000>+(<10000>*<0.1>)[11000.0]" +
              ">") do
    assert_not_in_epsilon(10000, 9000, 0.1)
  end
end
test_fail_because_negaitve_epsilon() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1981
def test_fail_because_negaitve_epsilon
  check_fail("The epsilon should not be negative.\n" +
              "<-0.1> was expected to be\n>=\n<0.0>.") do
    assert_not_in_epsilon(10000, 9000, -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 1970
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_epsilon(object, 9000, 0.1)
  end
end
test_fail_with_message() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1954
def test_fail_with_message
  check_fail("message.\n" +
              "<10000> -/+ (<10000> * <0.1>)[1000.0] " +
              "was expected to not include\n" +
              "<9000>.\n" +
              "\n" +
              "Relation:\n" +
              "<" +
              "<10000>-(<10000>*<0.1>)[9000.0] <= " +
              "<9000> <= " +
              "<10000>+(<10000>*<0.1>)[11000.0]" +
              ">") do
    assert_not_in_epsilon(10000, 9000, 0.1, "message")
  end
end
test_fail_without_epsilon() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1939
def test_fail_without_epsilon
  check_fail("<10000> -/+ (<10000> * <0.001>)[10.0] " +
              "was expected to not include\n" +
              "<9990>.\n" +
              "\n" +
              "Relation:\n" +
              "<" +
              "<10000>-(<10000>*<0.001>)[9990.0] <= " +
              "<9990> <= " +
              "<10000>+(<10000>*<0.001>)[10010.0]" +
              ">") do
    assert_not_in_epsilon(10000, 9990)
  end
end
test_pass() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1890
def test_pass
  check_nothing_fails do
    assert_not_in_epsilon(10000, 8999, 0.1)
  end
end
test_pass_float_like_object() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1908
def test_pass_float_like_object
  check_nothing_fails do
    float_thing = Object.new
    def float_thing.to_f
      8999.0
    end
    assert_not_in_epsilon(10000, float_thing, 0.1)
  end
end
test_pass_string_epxected() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1918
def test_pass_string_epxected
  check_nothing_fails do
    assert_not_in_epsilon("10000", 8999, 0.1)
  end
end
test_pass_with_message() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1902
def test_pass_with_message
  check_nothing_fails do
    assert_not_in_epsilon(10000, 8999, 0.1, "message")
  end
end
test_pass_without_epsilon() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1896
def test_pass_without_epsilon
  check_nothing_fails do
    assert_not_in_epsilon(10000, 9989)
  end
end