diff --git a/test_dl2.rb b/test_dl2.rb.new index 955ac1d..acbde5c 100644 --- a/test_dl2.rb +++ b/test_dl2.rb.new @@ -19,7 +19,7 @@ class TestDL < TestBase assert_equal ptr_id, ptr.to_i cfunc = CFunc.new(@libc['strcpy'], TYPE_VOIDP, 'strcpy') - cfunc.call([ptr_id,str].pack("l!p").unpack("l!*")) + cfunc.call([ptr_id,str].pack(PackInfo::PACK_MAP[TYPE_VOIDP]+"p").unpack(PackInfo::PACK_MAP[TYPE_VOIDP]+"*")) assert_equal("abc\0", ptr[0,4]) DL.free ptr_id end @@ -33,37 +33,37 @@ class TestDL < TestBase assert_equal ptr_id, ptr.to_i cfunc = CFunc.new(@libc['strcpy'], TYPE_VOIDP, 'strcpy') - cfunc.call([ptr_id,str].pack("l!p").unpack("l!*")) + cfunc.call([ptr_id,str].pack(PackInfo::PACK_MAP[TYPE_VOIDP]+"p").unpack(PackInfo::PACK_MAP[TYPE_VOIDP]+"*")) assert_equal("abc\0", ptr[0,4]) DL.free ptr_id end def test_call_int() cfunc = CFunc.new(@libc['atoi'], TYPE_INT, 'atoi') - x = cfunc.call(["100"].pack("p").unpack("l!*")) + x = cfunc.call(["100"].pack("p").unpack(PackInfo::PACK_MAP[TYPE_VOIDP]+"*")) assert_equal(100, x) cfunc = CFunc.new(@libc['atoi'], TYPE_INT, 'atoi') - x = cfunc.call(["-100"].pack("p").unpack("l!*")) + x = cfunc.call(["-100"].pack("p").unpack(PackInfo::PACK_MAP[TYPE_VOIDP]+"*")) assert_equal(-100, x) end def test_call_long() cfunc = CFunc.new(@libc['atol'], TYPE_LONG, 'atol') - x = cfunc.call(["100"].pack("p").unpack("l!*")) + x = cfunc.call(["100"].pack("p").unpack(PackInfo::PACK_MAP[TYPE_VOIDP]+"*")) assert_equal(100, x) cfunc = CFunc.new(@libc['atol'], TYPE_LONG, 'atol') - x = cfunc.call(["-100"].pack("p").unpack("l!*")) + x = cfunc.call(["-100"].pack("p").unpack(PackInfo::PACK_MAP[TYPE_VOIDP]+"*")) assert_equal(-100, x) end def test_call_double() cfunc = CFunc.new(@libc['atof'], TYPE_DOUBLE, 'atof') - x = cfunc.call(["0.1"].pack("p").unpack("l!*")) + x = cfunc.call(["0.1"].pack("p").unpack(PackInfo::PACK_MAP[TYPE_VOIDP]+"*")) assert_in_delta(0.1, x) cfunc = CFunc.new(@libc['atof'], TYPE_DOUBLE, 'atof') - x = cfunc.call(["-0.1"].pack("p").unpack("l!*")) + x = cfunc.call(["-0.1"].pack("p").unpack(PackInfo::PACK_MAP[TYPE_VOIDP]+"*")) assert_in_delta(-0.1, x) end @@ -83,7 +83,7 @@ class TestDL < TestBase def test_strlen() cfunc = CFunc.new(@libc['strlen'], TYPE_INT, 'strlen') - x = cfunc.call(["abc"].pack("p").unpack("l!*")) + x = cfunc.call(["abc"].pack("p").unpack(PackInfo::PACK_MAP[TYPE_VOIDP]+"*")) assert_equal("abc".size, x) end