diff options
author | ttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-05-25 16:37:58 +0000 |
---|---|---|
committer | ttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-05-25 16:37:58 +0000 |
commit | 7bdb1f5de82cd56e3ec9d171600e34a9d12b9637 (patch) | |
tree | 1f9cf93122e8968c2ee84d07b376fbed0b2005af /ext/dl/test/test.rb | |
parent | 8a98ca95cfe0b18f8b4a26ccd173172a8735bf62 (diff) |
* fixed the problems described in [ruby-dev:28665].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl/test/test.rb')
-rw-r--r-- | ext/dl/test/test.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/ext/dl/test/test.rb b/ext/dl/test/test.rb index 52be04699f..bf8dfc18e3 100644 --- a/ext/dl/test/test.rb +++ b/ext/dl/test/test.rb @@ -273,7 +273,7 @@ assert("data_aref", :must, GC.start -ptr = DL::malloc(1024) +ptr = DL::malloc(32) ptr.struct!("CHIL", "c", "h", "i", "l") ptr["c"] = 1 ptr["h"] = 2 @@ -291,5 +291,16 @@ ptr["n"] = 10 ptr["ptr"] = nil assert("struct!", :must, ptr["n"] == 10 && ptr["ptr"] == nil) +ptr = DL::malloc(16) +ptr.struct!("CICI", "c1", "i1", "c2", "i2") +ptr["c1"] = 0xf1 +ptr["c2"] = 0xf2 +c1 = [ptr["c1"]].pack("c").unpack("C")[0] +c2 = [ptr["c2"]].pack("c").unpack("C")[0] +assert("struct!", :must, + c1 == 0xf1 && + c2 == 0xf2) + + GC.start printf("fail/total = #{$FAIL}/#{$TOTAL}\n") |