1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

more tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2007-07-13 14:50:06 +00:00
parent 3cf28c2caa
commit 744701f404

View file

@ -59,6 +59,14 @@ class TestInteger < Test::Unit::TestCase
0x10000000000000000,
]
def test_aref
VS.each {|a|
100.times {|i|
assert_equal((a >> i).odd? ? 1 : 0, a[i], "(#{a})[#{i}]")
}
}
end
def test_plus
VS.each {|a|
VS.each {|b|
@ -231,6 +239,18 @@ class TestInteger < Test::Unit::TestCase
}
end
def test_cmp
VS.each_with_index {|a, i|
VS.each_with_index {|b, j|
assert_equal(i <=> j, a <=> b, "#{a} <=> #{b}")
assert_equal(i < j, a < b, "#{a} < #{b}")
assert_equal(i <= j, a <= b, "#{a} <= #{b}")
assert_equal(i > j, a > b, "#{a} > #{b}")
assert_equal(i >= j, a >= b, "#{a} >= #{b}")
}
}
end
def test_eq
VS.each_with_index {|a, i|
VS.each_with_index {|b, j|
@ -314,4 +334,14 @@ class TestInteger < Test::Unit::TestCase
end
}
end
def test_even_odd
VS.each {|a|
e = a.even?
o = a.odd?
assert_equal((a % 2) == 0, e, "(#{a}).even?")
assert_equal((a % 2) == 1, o, "(#{a}).odd")
assert(e ^ o)
}
end
end