diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-09 12:04:29 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-09 12:04:29 +0000 |
| commit | f0ce98de4fb9ce7097fa874f27618030d608a3dd (patch) | |
| tree | 34843c1819002cb6879b3fdca06ddaf79f788954 /test | |
| parent | a11df9a6ce282a27cdf67e93cc04151a1bfde14d (diff) | |
| download | ruby-f0ce98de4fb9ce7097fa874f27618030d608a3dd.tar.gz ruby-f0ce98de4fb9ce7097fa874f27618030d608a3dd.tar.xz ruby-f0ce98de4fb9ce7097fa874f27618030d608a3dd.zip | |
* test/dl/test_dl2.rb (test_call_double, test_sin): fixed argument
order.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
| -rw-r--r-- | test/dl/test_dl2.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/test/dl/test_dl2.rb b/test/dl/test_dl2.rb index 3c854aea8..e52adbc83 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() |
