mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/test_pack.rb: new test test_pack_N.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9008b4f3ea
commit
16bcd53d21
2 changed files with 16 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Fri Dec 26 14:05:13 2003 Minero Aoki <aamine@loveruby.net>
|
||||||
|
|
||||||
|
* test/ruby/test_pack.rb: new test test_pack_N.
|
||||||
|
|
||||||
Fri Dec 26 10:58:58 2003 NAKAMURA Usaku <usa@ruby-lang.org>
|
Fri Dec 26 10:58:58 2003 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* MANIFEST: add vms/config.h and remove vms/config.h_in.
|
* MANIFEST: add vms/config.h and remove vms/config.h_in.
|
||||||
|
|
|
@ -18,4 +18,16 @@ class TestPack < Test::Unit::TestCase
|
||||||
$x = [-1073741825]
|
$x = [-1073741825]
|
||||||
assert_equal($x, $x.pack("q").unpack("q"))
|
assert_equal($x, $x.pack("q").unpack("q"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_pack_N
|
||||||
|
assert_equal "\000\000\000\000", [0].pack('N')
|
||||||
|
assert_equal "\000\000\000\001", [1].pack('N')
|
||||||
|
assert_equal "\000\000\000\002", [2].pack('N')
|
||||||
|
assert_equal "\000\000\000\003", [3].pack('N')
|
||||||
|
assert_equal "\377\377\377\376", [4294967294].pack('N')
|
||||||
|
assert_equal "\377\377\377\377", [4294967295].pack('N')
|
||||||
|
|
||||||
|
assert_equal "\000\000\000\001\000\000\000\001", [1,1].pack('N*')
|
||||||
|
assert_equal "\000\000\000\001\000\000\000\001\000\000\000\001", [1,1,1].pack('N*')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue