Sha256: 93f3a2488a66a5969ead472ac95300bec4b61ed8d791a70586686e84bd201d8d

Contents?: true

Size: 416 Bytes

Versions: 27

Compression:

Stored size: 416 Bytes

Contents

require 'test_helper'

# This tests our rounding extension
class Integer::RoundingTest < Minitest::Test
  def test_rounding
    assert_equal 124_000, 123_221.round_up_to(3)
    assert_equal 123_300, 123_221.round_up_to(4)
    assert_equal 760, 758.round_up_to(2)
    assert_equal 3453, 3452.round_up_to(4)
    assert_nil 1.round_up_to(2)
    refute_nil 10.round_up_to(2)
    assert_nil 12.round_up_to(-45)
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
ndr_support-5.10.4 test/integer/rounding_test.rb
ndr_support-5.10.3 test/integer/rounding_test.rb
ndr_support-5.10.2 test/integer/rounding_test.rb
ndr_support-5.10.1 test/integer/rounding_test.rb
ndr_support-5.10.0 test/integer/rounding_test.rb
ndr_support-5.9.7 test/integer/rounding_test.rb
ndr_support-5.9.6 test/integer/rounding_test.rb
ndr_support-5.9.5 test/integer/rounding_test.rb
ndr_support-5.9.4 test/integer/rounding_test.rb
ndr_support-5.9.3 test/integer/rounding_test.rb
ndr_support-5.9.2 test/integer/rounding_test.rb
ndr_support-5.9.1 test/integer/rounding_test.rb
ndr_support-5.9.0 test/integer/rounding_test.rb
ndr_support-5.8.4 test/integer/rounding_test.rb
ndr_support-5.8.3 test/integer/rounding_test.rb
ndr_support-5.8.2 test/integer/rounding_test.rb
ndr_support-5.8.1 test/integer/rounding_test.rb
ndr_support-5.8.0 test/integer/rounding_test.rb
ndr_support-5.7.1 test/integer/rounding_test.rb
ndr_support-5.7.0 test/integer/rounding_test.rb