Sha256: 1f16ba5d164bbb1f0ed4b229d23d14a4bd3bd3dea18d2b396287f19c8b9cc773

Contents?: true

Size: 608 Bytes

Versions: 4

Compression:

Stored size: 608 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__),'helper.rb'))

class TestCoercion < Minitest::Test


  def setup
    initialize_context
  end

  def test_coerce
    assert_equal DecNum('7.1'), DecNum('0.1') + 7
    assert_equal DecNum('7.1'), 7 + DecNum('0.1')
    assert_equal DecNum('14'), DecNum(7) * 2
    assert_equal DecNum('14'), 2 * DecNum(7)

    assert_equal DecNum('7.1'), DecNum(7) + Rational(1,10)
    assert_equal DecNum('7.1'), Rational(1,10) + DecNum(7)
    assert_equal DecNum('1.4'), DecNum(7) * Rational(2,10)
    assert_equal DecNum('1.4'), Rational(2,10) * DecNum(7)
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
flt-1.5.4 test/test_coercion.rb
flt-1.5.3 test/test_coercion.rb
flt-1.5.2 test/test_coercion.rb
flt-1.5.1 test/test_coercion.rb