class Test::Unit::TestAssertInEpsilon

Public Instance Methods

test_fail_because_negaitve_epsilon() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1864
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_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 1853
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_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 1837
def test_fail_with_message
  check_fail("message.\n" +
              "<10000> -/+ (<10000> * <0.1>)[1000.0] " +
              "was expected to include\n" +
              "<8999>.\n" +
              "\n" +
              "Relation:\n" +
              "<" +
              "<8999> < " +
              "<10000>-(<10000>*<0.1>)[9000.0] <= " +
              "<10000>+(<10000>*<0.1>)[11000.0]" +
              ">") do
    assert_in_epsilon(10000, 8999, 0.1, "message")
  end
end
test_fail_without_epsilon() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1871
def test_fail_without_epsilon
  check_fail("<10000> -/+ (<10000> * <0.001>)[10.0] " +
              "was expected to include\n" +
              "<10011>.\n" +
              "\n" +
              "Relation:\n" +
              "<" +
              "<10000>-(<10000>*<0.001>)[9990.0] <= " +
              "<10000>+(<10000>*<0.001>)[10010.0] < " +
              "<10011>" +
              ">") do
    assert_in_epsilon(10000, 10011)
  end
end
test_pass() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1791
def test_pass
  check_nothing_fails do
    assert_in_epsilon(10000, 9000, 0.1)
  end
end
test_pass_float_like_object() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1809
def test_pass_float_like_object
  check_nothing_fails do
    float_thing = Object.new
    def float_thing.to_f
      9000.0
    end
    assert_in_epsilon(10000, float_thing, 0.1)
  end
end
test_pass_minus_expected() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1831
def test_pass_minus_expected
  check_nothing_fails do
    assert_in_epsilon(-1, -1)
  end
end
test_pass_string_expected() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1819
def test_pass_string_expected
  check_nothing_fails do
    assert_in_epsilon("10000", 9000, 0.1)
  end
end
test_pass_with_message() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1803
def test_pass_with_message
  check_nothing_fails do
    assert_in_epsilon(10000, 9000, 0.1, "message")
  end
end
test_pass_without_epsilon() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1797
def test_pass_without_epsilon
  check_nothing_fails do
    assert_in_epsilon(10000, 9991)
  end
end
test_pass_zero_expected() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1825
def test_pass_zero_expected
  check_nothing_fails do
    assert_in_epsilon(0, 0.00000001)
  end
end