Sha256: da7f3d3e2deb833ecbd8e5932872fa45e773da247d048235445d0d1acfdf8a14

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

module Etest::ComparisonAssertions
  def assert_lt(p1, p2)
    assert(p1 < p2, "#{p1.inspect} should be less than #{p2.inspect} but is not")
  end

  def assert_le(p1, p2)
    assert(p1 <= p2, "#{p1.inspect} should be less than or equal #{p2.inspect} but is not")
  end

  def assert_ge(p1, p2)
    assert(p1 >= p2, "#{p1.inspect} should be greater than or equal #{p2.inspect} but is not")
  end

  def assert_gt(p1, p2)
    assert(p1 > p2, "#{p1.inspect} should be greater than #{p2.inspect} but is not")
  end

  # for reasons of API completeness and orthogonality only.

  def assert_eq(p1, p2)
    assert_equal(p1, p2)
  end

  def assert_ne(p1, p2)
    assert_not_equal(p1, p2)
  end
end

class MiniTest::Unit::TestCase
  include ::Etest::ComparisonAssertions
end

unless defined?(ETEST_TEST)

  module Etest::ComparisonAssertions::Etest
    # I don't know how to test asserts. This, at least, give (fake) C0 coverage
    def test_comparision_assertions
      assert_lt 1, 2
      assert_le 1, 1
      assert_ge 2, 2
      assert_gt 2, 1
      assert_eq 2, 2
      assert_ne 1, 2
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
etest-0.4.2 lib/etest/comparison_assertions.rb
etest-0.4.1 lib/etest/comparison_assertions.rb
etest-0.4 lib/etest/comparison_assertions.rb
etest-0.3.1 lib/etest/comparison_assertions.rb