From 583c8e89153dc5fab189d24b6688c31a70a63dbb Mon Sep 17 00:00:00 2001 From: akr Date: Tue, 2 Apr 2013 11:28:57 +0000 Subject: * 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 --- test/ruby/test_pack.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') 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 -- cgit v1.2.3