diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-01 01:53:32 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-01 01:53:32 +0000 |
commit | 9db6fb5ce56ee2e911944377edb02cb493e428b1 (patch) | |
tree | ad7a630cf9f3a260a27b6cd621227bc213aa9027 | |
parent | b3009ced333c57456d7d1534b5ecd90b85f15b8e (diff) | |
download | ruby-9db6fb5ce56ee2e911944377edb02cb493e428b1.tar.gz |
add test_pack_U.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | test/ruby/test_pack.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_pack.rb b/test/ruby/test_pack.rb index 863dfbe82f..4003004c7f 100644 --- a/test/ruby/test_pack.rb +++ b/test/ruby/test_pack.rb @@ -42,4 +42,15 @@ class TestPack < Test::Unit::TestCase assert_equal [1,1], "\000\000\000\001\000\000\000\001".unpack('N*') assert_equal [1,1,1], "\000\000\000\001\000\000\000\001\000\000\000\001".unpack('N*') end + + def test_pack_U + assert_raises(RangeError) { [-0x40000001].pack("U") } + assert_raises(RangeError) { [-0x40000000].pack("U") } + assert_raises(RangeError) { [-1].pack("U") } + assert_equal "\000", [0].pack("U") + assert_equal "\374\277\277\277\277\277", [0x3fffffff].pack("U") + assert_equal "\375\200\200\200\200\200", [0x40000000].pack("U") + assert_equal "\375\277\277\277\277\277", [0x7fffffff].pack("U") + assert_raises(RangeError) { [0x80000000].pack("U") } + end end |