Sha256: 983b445964fa85a99eb4ffdcfdca18f2035d544c68004089af7caa9651957228

Contents?: true

Size: 795 Bytes

Versions: 14

Compression:

Stored size: 795 Bytes

Contents

# Test facets/infinity.rb

require 'facets/infinity.rb'

require 'test/unit'

class GeneralTest < Test::Unit::TestCase

  def test_pos
    assert_equal((1.0/0), INFINITY.to_f)
    assert_equal(1, INFINITY<=>5)
    assert_equal(1, INFINITY<=>"a")
    assert_equal("PosInf", INFINITY.to_s)
  end

  def test_neg
    assert_equal((-1.0/0), -INFINITY.to_f)
    assert_equal(-1, -INFINITY<=>5)
    assert_equal(-1, -INFINITY<=>"a")
    assert_equal("NegInf", (-INFINITY).to_s)
  end

  def test_ord
    assert_equal((-1.0/0), -INFINITY.to_f)
    assert_equal(-1, 5<=>INFINITY)
    assert_equal(1, 5<=>-INFINITY)
  end

  def test_eq
    assert_equal(Inf, Inf)
    assert_equal(-Inf, -Inf)
    assert_equal(PosInf, PosInf)
    assert_equal(NegInf, NegInf)
    assert_not_equal(NaN, NaN)
  end

end



Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
facets-2.6.0 test/more/test_infinity.rb
facets-2.1.3 test/unit/test_infinity.rb
facets-2.2.0 test/unit/test_infinity.rb
facets-2.3.0 test/class/test_infinity.rb
facets-2.4.0 test/test_infinity.rb
facets-2.2.1 test/unit/test_infinity.rb
facets-2.4.1 test/test_infinity.rb
facets-2.4.2 test/more/test_infinity.rb
facets-2.4.3 test/more/test_infinity.rb
facets-2.4.4 test/more/test_infinity.rb
facets-2.4.5 test/more/test_infinity.rb
facets-2.5.0 test/more/test_infinity.rb
facets-2.5.1 test/more/test_infinity.rb
facets-2.5.2 test/more/test_infinity.rb