summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-09 12:04:29 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-09 12:04:29 +0000
commit098d8d11e180e49493004685a46389bc91a75250 (patch)
tree34843c1819002cb6879b3fdca06ddaf79f788954 /test
parentba6e61d6f568401c8527861f560b42954c7fa05a (diff)
* test/dl/test_dl2.rb (test_call_double, test_sin): fixed argument
order. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/dl/test_dl2.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/test/dl/test_dl2.rb b/test/dl/test_dl2.rb
index 3c854aea8f..e52adbc83e 100644
--- a/test/dl/test_dl2.rb
+++ b/test/dl/test_dl2.rb
@@ -25,21 +25,22 @@ class TestDL < TestBase
def test_call_double()
cfunc = CFunc.new(@libc['atof'], TYPE_DOUBLE, 'atof')
x = cfunc.call(["0.1"].pack("p").unpack("l!*"))
- assert_match(0.09..0.11, x)
+ assert_in_delta(0.1, x)
cfunc = CFunc.new(@libc['atof'], TYPE_DOUBLE, 'atof')
x = cfunc.call(["-0.1"].pack("p").unpack("l!*"))
- assert_match(-0.11 .. -0.09, x)
+ assert_in_delta(-0.1, x)
end
def test_sin()
+ pi_2 = Math::PI/2
cfunc = CFunc.new(@libm['sin'], TYPE_DOUBLE, 'sin')
- x = cfunc.call([3.14/2].pack("d").unpack("l!*"))
- assert_equal(x, Math.sin(3.14/2))
+ x = cfunc.call([pi_2].pack("d").unpack("l!*"))
+ assert_equal(Math.sin(pi_2), x)
cfunc = CFunc.new(@libm['sin'], TYPE_DOUBLE, 'sin')
- x = cfunc.call([-3.14/2].pack("d").unpack("l!*"))
- assert_equal(Math.sin(-3.14/2), x)
+ x = cfunc.call([-pi_2].pack("d").unpack("l!*"))
+ assert_equal(Math.sin(-pi_2), x)
end
def test_strlen()