ruby-changes:13073
From: nobu <ko1@a...>
Date: Wed, 9 Sep 2009 21:04:38 +0900 (JST)
Subject: [ruby-changes:13073] Ruby:r24820 (trunk): * test/dl/test_dl2.rb (test_call_double, test_sin): fixed argument
nobu 2009-09-09 21:04:29 +0900 (Wed, 09 Sep 2009) New Revision: 24820 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=24820 Log: * test/dl/test_dl2.rb (test_call_double, test_sin): fixed argument order. Modified files: trunk/test/dl/test_dl2.rb Index: test/dl/test_dl2.rb =================================================================== --- test/dl/test_dl2.rb (revision 24819) +++ test/dl/test_dl2.rb (revision 24820) @@ -25,21 +25,22 @@ 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() -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/