aboutsummaryrefslogblamecommitdiffstats
path: root/activesupport/test/core_ext/fixnum_ext_test.rb
blob: 627c282b8b85f5b437d7a8aa75b370b9615a750e (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14













                                                                            
require 'test/unit'
require File.dirname(__FILE__) + '/../../lib/active_support/core_ext/fixnum'

class FixnumExtTest < Test::Unit::TestCase
  def test_even
    assert [ -2, 0, 2, 4 ].all? { |i| i.even? }
    assert ![ -1, 1, 3 ].all? { |i| i.even? }
  end

  def test_odd
    assert ![ -2, 0, 2, 4 ].all? { |i| i.odd? }
    assert [ -1, 1, 3 ].all? { |i| i.odd? }
  end
end