aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-04-05 16:54:17 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-04-05 16:54:17 +0000
commitd08271e62f4cd5b3c42f3e385d9166f6e591cbaa (patch)
treed050396a511489eb180d3b38156d1db426916508 /activesupport/test
parent97e39fcb6418a5b1d5254ebb1059df796db21701 (diff)
downloadrails-d08271e62f4cd5b3c42f3e385d9166f6e591cbaa.tar.gz
rails-d08271e62f4cd5b3c42f3e385d9166f6e591cbaa.tar.bz2
rails-d08271e62f4cd5b3c42f3e385d9166f6e591cbaa.zip
Added Fixnum#even? and Fixnum#odd?
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1094 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/fixnum_ext_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/fixnum_ext_test.rb b/activesupport/test/core_ext/fixnum_ext_test.rb
new file mode 100644
index 0000000000..627c282b8b
--- /dev/null
+++ b/activesupport/test/core_ext/fixnum_ext_test.rb
@@ -0,0 +1,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