From a9e662ac7aebe26c927dfdc1ef2a35eccffc470c Mon Sep 17 00:00:00 2001 From: tenderlove Date: Sun, 1 Nov 2009 01:47:08 +0000 Subject: * ext/dl/cptr.c (rb_dlptr_ptr, rb_dlptr_ref) adding documentation * test/dl/test_cptr.rb (test_ref_ptr) testing CPtr#ref and CPtr#ptr git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/dl/test_cptr.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/dl/test_cptr.rb b/test/dl/test_cptr.rb index 461b7d27d4..2a55a07dee 100644 --- a/test/dl/test_cptr.rb +++ b/test/dl/test_cptr.rb @@ -3,6 +3,14 @@ require_relative '../ruby/envutil' module DL class TestCPtr < TestBase + def test_ref_ptr + ary = [0,1,2,4,5] + addr = CPtr.new(dlwrap(ary)) + assert_equal addr.to_i, addr.ref.ptr.to_i + + assert_equal addr.to_i, (+ (- addr)).to_i + end + def test_to_value ary = [0,1,2,4,5] addr = CPtr.new(dlwrap(ary)) -- cgit v1.2.3