mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
ba6e61d6f5
commit
098d8d11e1
1 changed files with 7 additions and 6 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue