diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-12 09:12:14 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-12 09:12:14 +0000 |
commit | 0da34dbb26f3fc2770bd4e0c23ff99d00b4640b3 (patch) | |
tree | a787e4b4d2bd971ba6956aef5027321d4d1e1b07 /test/ruby | |
parent | 91df3e9b742474215f18dfaa1f63f279341faf17 (diff) |
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/ruby')
-rw-r--r-- | test/ruby/test_integer_comb.rb | 24 |
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| |