From 098d8d11e180e49493004685a46389bc91a75250 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 9 Sep 2009 12:04:29 +0000 Subject: [PATCH] * 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 --- test/dl/test_dl2.rb | 13 +++++++------ 1 file 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()