summaryrefslogtreecommitdiff
path: root/test/dl/test_func.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/dl/test_func.rb')
-rw-r--r--test/dl/test_func.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/dl/test_func.rb b/test/dl/test_func.rb
index 5503f350c8..3900af3d5f 100644
--- a/test/dl/test_func.rb
+++ b/test/dl/test_func.rb
@@ -15,6 +15,24 @@ module DL
assert_equal cfunc.to_i, f.to_i
end
+ def test_random
+ f = Function.new(CFunc.new(@libc['srand'], TYPE_VOID, 'srand'),
+ [-TYPE_LONG])
+ assert_nil f.call(10)
+ end
+
+ def test_sinf
+ f = Function.new(CFunc.new(@libm['sinf'], TYPE_FLOAT, 'sinf'),
+ [TYPE_FLOAT])
+ assert_in_delta 1.0, f.call(90 * Math::PI / 180), 0.0001
+ end
+
+ def test_sin
+ f = Function.new(CFunc.new(@libm['sin'], TYPE_DOUBLE, 'sin'),
+ [TYPE_DOUBLE])
+ assert_in_delta 1.0, f.call(90 * Math::PI / 180), 0.0001
+ end
+
def test_strcpy()
f = Function.new(CFunc.new(@libc['strcpy'], TYPE_VOIDP, 'strcpy'),
[TYPE_VOIDP, TYPE_VOIDP])