⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Backport21
All Projects
Ruby
»
Backport21
Overview
Activity
Issues
Like
Download (779 Bytes)
Backport #9305
ยป bigdecimal_spec.rb
kwerle (Kurt Werle)
, 12/27/2013 06:57 AM
# Values are taken from non-shareable code base
require
'bigdecimal'
require
'minitest/autorun'
describe
BigDecimal
do
before
do
@args
=
{
north_south:
700
,
cam_load:
BigDecimal
.
new
(
"0.9932"
)}
@max_force
=
BigDecimal
.
new
"0.344045"
end
it
"should have a numerator"
do
assert_in_delta
@args
[
:cam_load
],
0.9932
end
it
"should have a denominator"
do
assert_in_delta
((
@args
[
:north_south
]
*
@max_force
)
/
BigDecimal
.
new
(
'1000.0'
)),
0.2408315
end
it
"should pass float math"
do
assert_in_delta
0.9932
/
0.2408315
,
4.124045235
end
# This test passes on ruby 2.0 and fails on Ruby 2.1
it
"should pass big math"
do
assert_in_delta
@args
[
:cam_load
]
/
((
@args
[
:north_south
]
*
@max_force
)
/
BigDecimal
.
new
(
'1000.0'
)),
4.124045235
end
end
(1-1/1)
Loading...