mruby-pack/test/pack.rb: test B/b directives

This commit is contained in:
Yukihiro "Matz" Matsumoto
2023-07-20 16:58:36 +09:00
parent e7021f190a
commit 0eceadd037
+10
View File
@@ -38,6 +38,16 @@ assert('pack("M")') do
assert_equal [""], "=E3=81=82=\n".unpack("M")
end
# pack & unpack 'B'/'b'
assert('pack("B/b")') do
assert_pack "b*", "\xFF\x00", ["1111111100000000"]
assert_pack "b*", "\x01\x02", ["1000000001000000"]
assert_pack "b3", "\x01", ["100"]
assert_pack "B*", "\xFF\x00", ["1111111100000000"]
assert_pack "B*", "\x01\x02", ["0000000100000010"]
end
# pack & unpack 'H'
assert('pack("H")') do
assert_pack "H*", "01", ["3031"]