test/pack.c: reorganize test suits.
MODIFY
mrbgems/mruby-pack/test/pack.rb
mrbgems/mruby-pack/test/pack.rb
@@ -10,78 +10,48 @@ def assert_pack tmpl, packed, unpacked
end
# pack & unpack 'm' (base64)
-assert('[""].pack("m")') do
+assert('pack("m")') do
assert_pack "m", "", [""]
-end
-
-assert('["\0"].pack("m")') do
assert_pack "m", "AA==\n", ["\0"]
-end
-
-assert('["\0\0"].pack("m")') do
assert_pack "m", "AAA=\n", ["\0\0"]
-end
-
-assert('["\0\0\0"].pack("m")') do
assert_pack "m", "AAAA\n", ["\0\0\0"]
-end
-
-assert('["abc..xyzABC..XYZ"].pack("m")') do
assert_pack "m", "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJT\nVFVWV1hZWg==\n", ["abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"]
-end
-assert('"YWJ...".unpack("m") should "abc..xyzABC..XYZ"') do
ary = ["abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"]
assert_equal ary, "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJT\nVFVWV1hZWg==\n".unpack("m")
assert_equal ary, "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWg==\n".unpack("m")
-end
-assert('["A", "B"].pack') do
assert_equal "QQ==\n", ["A", "B"].pack("m50")
assert_equal ["A"], "QQ==\n".unpack("m50")
assert_equal "QQ==Qg==", ["A", "B"].pack("m0 m0")
assert_equal ["A", "B"], "QQ==Qg==".unpack("m10 m10")
-end
-
-assert('["abc..xyzABC..XYZ"].pack("m0")') do
assert_pack "m0", "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWg==", ["abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"]
end
# pack & unpack 'H'
-assert('["3031"].pack("H*")') do
+assert('pack("H")') do
assert_pack "H*", "01", ["3031"]
-end
-
-assert('["10"].pack("H*")') do
assert_pack "H*", "\020", ["10"]
end
-assert('[0,1,127,128,255].pack("C*")') do
+assert('pack("C")') do
assert_pack "C*", "\x00\x01\x7F\x80\xFF", [0, 1, 127, 128, 255]
end
-# pack "a"
-assert('["abc"].pack("a")') do
+assert('pack("a")') do
assert_equal "a", ["abc"].pack("a")
assert_equal "abc", ["abc"].pack("a*")
assert_equal "abc\0", ["abc"].pack("a4")
-end
-# upack "a"
-assert('["abc"].pack("a")') do
assert_equal ["abc\0"], "abc\0".unpack("a4")
assert_equal ["abc "], "abc ".unpack("a4")
end
-# pack "A"
-assert('["abc"].pack("A")') do
+assert('pack("A")') do
assert_equal "a", ["abc"].pack("A")
assert_equal "abc", ["abc"].pack("A*")
assert_equal "abc ", ["abc"].pack("A4")
-end
-# upack "A"
-assert('["abc"].pack("A")') do
assert_equal ["abc"], "abc\0".unpack("A4")
assert_equal ["abc"], "abc ".unpack("A4")
end

test/pack.c: reorganize test suits.