test/unitwise/functional_test.rb in unitwise-0.6.0 vs test/unitwise/functional_test.rb in unitwise-0.6.1
- old
+ new
@@ -3,13 +3,14 @@
describe Unitwise::Functional do
subject { Unitwise::Functional }
%w{cel degf hpX hpC tan100 ph ld ln lg 2lg}.each do |function|
describe function do
it 'should convert back and forth' do
- number = rand.round(5)
+ number = rand(1000) / 1000.0
there = subject.send "to_#{function}", number
back_again = subject.send "from_#{function}", there
- back_again.round(5).must_equal number
+ rounded_result = (back_again * 1000).round / 1000.0
+ rounded_result.must_equal number
end
end
end
end