Sha256: f207b2e5900b4ab594dffe6bc9942f13e8f82cc6dd75190afffc7db183ce0dfe

Contents?: true

Size: 910 Bytes

Versions: 6

Compression:

Stored size: 910 Bytes

Contents

#      _____         _
#    |_   _|__  ___| |_
#     | |/ _ \/ __| __|
#    | |  __/\__ \ |
#   |_|\___||___/\__|
#
# for 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

6 entries across 6 versions & 1 rubygems

Version Path
facets-2.0.3 test/unit/test_infinity.rb
facets-2.0.4 test/unit/test_infinity.rb
facets-2.0.5 test/unit/test_infinity.rb
facets-2.1.0 test/unit/test_infinity.rb
facets-2.1.1 test/unit/test_infinity.rb
facets-2.1.2 test/unit/test_infinity.rb