diff options
Diffstat (limited to 'ext/dl/test/test.rb')
-rw-r--r-- | ext/dl/test/test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/ext/dl/test/test.rb b/ext/dl/test/test.rb index cd63ff190e..e6a7f33623 100644 --- a/ext/dl/test/test.rb +++ b/ext/dl/test/test.rb @@ -264,6 +264,7 @@ assert("data_aref", :must, ptr["name"].collect{|c| c.chr}.join.split("\0")[0] == "name2") assert("data_aref", :must, ptr["name"].collect{|c| c.chr}.join.split("\0")[0] == "name2") unless (Fixnum === :-) + ptr = ptr["next"] ptr.struct!("C1024P", :name, :next) assert("data_aref", :must, @@ -272,3 +273,17 @@ assert("data_aref", :must, ptr["name"].collect{|c| c.chr}.join.split("\0")[0] == "name1") unless (Fixnum === :-) GC.start + +ptr = DL::malloc(1024) +ptr.struct!("CHIL", "c", "h", "i", "l") +ptr["c"] = 1 +ptr["h"] = 2 +ptr["i"] = 3 +ptr["l"] = 4 +assert("struct!", :must, + ptr["c"] == 1 && + ptr["h"] == 2 && + ptr["i"] == 3 && + ptr["l"] == 4) + +GC.start |