diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-02 11:28:57 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-02 11:28:57 +0000 |
commit | 583c8e89153dc5fab189d24b6688c31a70a63dbb (patch) | |
tree | 3538b2025b37eabae4c2ca35c2b285d3a0a6021c /test/ruby/test_pack.rb | |
parent | 6d0c59f156da08a6a669a3187f86b424ce147626 (diff) | |
download | ruby-583c8e89153dc5fab189d24b6688c31a70a63dbb.tar.gz |
* pack.c: Support Q! and q! for long long.
(natstr): Moved to toplevel. Add q and Q if there is long long type.
(endstr): Moved to toplevel.
(NATINT_PACK): Consider long long.
(NATINT_LEN_Q): New macro.
(pack_pack): Support Q! and q!.
(pack_unpack): Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_pack.rb')
-rw-r--r-- | test/ruby/test_pack.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_pack.rb b/test/ruby/test_pack.rb index 76956ef25f..a088953b78 100644 --- a/test/ruby/test_pack.rb +++ b/test/ruby/test_pack.rb @@ -403,8 +403,15 @@ class TestPack < Test::Unit::TestCase assert_equal([578437695752307201, -506097522914230529], s2.unpack("q*")) assert_equal([578437695752307201, 17940646550795321087], s1.unpack("Q*")) + s1 = [578437695752307201, -506097522914230529].pack("q!*") + s2 = [578437695752307201, 17940646550795321087].pack("Q!*") + assert_equal([578437695752307201, -506097522914230529], s2.unpack("q!*")) + assert_equal([578437695752307201, 17940646550795321087], s1.unpack("Q!*")) + assert_equal(8, [1].pack("q").bytesize) assert_equal(8, [1].pack("Q").bytesize) + assert_operator(8, :<=, [1].pack("q!").bytesize) + assert_operator(8, :<=, [1].pack("Q!").bytesize) end def test_pack_unpack_nN |