aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-12 09:12:14 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-12 09:12:14 +0000
commit0d021fcba451f5a0ec99ac9949622e8e0344cc18 (patch)
treea787e4b4d2bd971ba6956aef5027321d4d1e1b07 /test
parentba40331d04aa39eecd38c3a92d151d542764feff (diff)
downloadruby-0d021fcba451f5a0ec99ac9949622e8e0344cc18.tar.gz
Integer#allbits?, Integer#anybits?, Integer#nobits? [Feature #12753]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_integer_comb.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ruby/test_integer_comb.rb b/test/ruby/test_integer_comb.rb
index 80d08cac04..1ad13dd31b 100644
--- a/test/ruby/test_integer_comb.rb
+++ b/test/ruby/test_integer_comb.rb
@@ -457,6 +457,30 @@ class TestIntegerComb < Test::Unit::TestCase
}
end
+ def test_allbits_p
+ VS.each {|a|
+ VS.each {|b|
+ assert_equal((a & b) == b, a.allbits?(b), "(#{a}).allbits?(#{b}")
+ }
+ }
+ end
+
+ def test_anybits_p
+ VS.each {|a|
+ VS.each {|b|
+ assert_equal((a & b) != 0, a.anybits?(b), "(#{a}).anybits?(#{b}")
+ }
+ }
+ end
+
+ def test_nobits_p
+ VS.each {|a|
+ VS.each {|b|
+ assert_equal((a & b) == 0, a.nobits?(b), "(#{a}).nobits?(#{b}")
+ }
+ }
+ end
+
def test_to_s
2.upto(36) {|radix|
VS.each {|a|