summaryrefslogtreecommitdiff
path: root/test/dl/test_cptr.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/dl/test_cptr.rb')
-rw-r--r--test/dl/test_cptr.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/dl/test_cptr.rb b/test/dl/test_cptr.rb
new file mode 100644
index 0000000000..2d6a08e1c5
--- /dev/null
+++ b/test/dl/test_cptr.rb
@@ -0,0 +1,18 @@
+require_relative 'test_base'
+
+module DL
+ class TestCPtr < TestBase
+ def test_free
+ ptr = CPtr.malloc(4)
+ assert_nil ptr.free
+ end
+
+ def test_free=
+ free = CFunc.new(@libc['free'], TYPE_VOID, 'free')
+ ptr = CPtr.malloc(4)
+ ptr.free = free
+
+ assert_equal free.ptr, ptr.free.ptr
+ end
+ end
+end