summaryrefslogtreecommitdiffhomepage
path: root/test/pack.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/pack.rb')
-rw-r--r--test/pack.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/pack.rb b/test/pack.rb
index 5e9932f4f..e9f5fb040 100644
--- a/test/pack.rb
+++ b/test/pack.rb
@@ -145,3 +145,17 @@ assert 'pack/unpack "I"' do
end
assert_pack 'I', str, [12345]
end
+
+assert 'pack/unpack "U"' do
+ assert_equal [], "".unpack("U")
+ assert_equal [], "".unpack("U*")
+ assert_equal [65, 66], "ABC".unpack("U2")
+ assert_equal [12371, 12435, 12395, 12385, 12399, 19990, 30028], "こんにちは世界".unpack("U*")
+
+ assert_equal "", [].pack("U")
+ assert_equal "", [].pack("U*")
+ assert_equal "AB", [65, 66, 67].pack("U2")
+ assert_equal "こんにちは世界", [12371, 12435, 12395, 12385, 12399, 19990, 30028].pack("U*")
+
+ assert_equal "\000", [0].pack("U")
+end