summaryrefslogtreecommitdiff
path: root/test/dl
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-25 05:47:16 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-25 05:47:16 +0000
commitb4288080e7d025729f88479c44ed054f65b30f60 (patch)
tree2f77c1a499dd3a53e17e22f99de797f6a5e9afb9 /test/dl
parentd9adb03dd902c1cf7e5fadc8320dccec0ef73139 (diff)
* ext/dl/dl.c (Init_dl): support intrinsic types, size_t, ptrdiff_t
and intptr_t. [ruby-core:42460][Feature #5992] * ext/fiddle/fiddle.c (Init_fiddle): ditto. * ext/dl/lib/dl/cparser.rb (DL::CParser#parse_ctype): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/dl')
-rw-r--r--test/dl/test_cparser.rb20
-rw-r--r--test/dl/test_dl2.rb12
2 files changed, 32 insertions, 0 deletions
diff --git a/test/dl/test_cparser.rb b/test/dl/test_cparser.rb
index 3be727a759..cea9ac73b0 100644
--- a/test/dl/test_cparser.rb
+++ b/test/dl/test_cparser.rb
@@ -9,5 +9,25 @@ module DL
def test_uint_ctype
assert_equal(-DL::TYPE_INT, parse_ctype('uint'))
end
+
+ def test_size_t_ctype
+ assert_equal(DL::TYPE_SIZE_T, parse_ctype("size_t"))
+ end
+
+ def test_ssize_t_ctype
+ assert_equal(DL::TYPE_SSIZE_T, parse_ctype("ssize_t"))
+ end
+
+ def test_ptrdiff_t_ctype
+ assert_equal(DL::TYPE_PTRDIFF_T, parse_ctype("ptrdiff_t"))
+ end
+
+ def test_intptr_t_ctype
+ assert_equal(DL::TYPE_INTPTR_T, parse_ctype("intptr_t"))
+ end
+
+ def test_uintptr_t_ctype
+ assert_equal(DL::TYPE_UINTPTR_T, parse_ctype("uintptr_t"))
+ end
end
end
diff --git a/test/dl/test_dl2.rb b/test/dl/test_dl2.rb
index 1d6e39114f..8f4275fb65 100644
--- a/test/dl/test_dl2.rb
+++ b/test/dl/test_dl2.rb
@@ -151,5 +151,17 @@ class TestDL < TestBase
ary2 = dlunwrap(addr)
assert_equal(ary, ary2)
end
+
+ def test_type_size_t
+ assert_equal(DL::TYPE_SSIZE_T, DL::TYPE_SIZE_T.abs)
+ end
+
+ def test_type_uintptr_t
+ assert_equal(-DL::TYPE_INTPTR_T, DL::TYPE_UINTPTR_T)
+ end
+
+ def test_sizeof_uintptr_t
+ assert_equal(DL::SIZEOF_VOIDP, DL::SIZEOF_INTPTR_T)
+ end
end
end # module DL