Sha256: e252ed75943548a40f1947e039a6e235ddb891b50eb9b09fe86720a064064c12

Contents?: true

Size: 581 Bytes

Versions: 1

Compression:

Stored size: 581 Bytes

Contents

require 'test_helper'

class IntegerTest < Test::Unit::TestCase
  def test_string
    assert "0".integer?
    assert "-1".integer?
    assert !"1.0".integer?

    assert !"a".integer?
    assert !"1a".integer?
    assert !"a1".integer?
  end

  def test_symbol
    assert :'0'.integer?

    assert !:a.integer?
  end

  def test_object
    assert !Object.new.integer?
    assert !{}.integer?
  end

  def test_numeric
    assert 1.integer?
    assert !Rational(1,2).integer?
    assert !Complex(1, 1).integer?
    assert !2.3.integer?
    assert !BigDecimal('1').integer?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
numeric-0.2.0 test/integer_test.rb