Sha256: d6a41637d7e2d5e5b2ff0ec34cd72ac2cbba7b25fa26ba53b16011480b3a9f75

Contents?: true

Size: 614 Bytes

Versions: 20

Compression:

Stored size: 614 Bytes

Contents

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

class TestCoercion < Test::Unit::TestCase


  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

20 entries across 20 versions & 1 rubygems

Version Path
flt-1.5.0 test/test_coercion.rb
flt-1.4.7 test/test_coercion.rb
flt-1.4.6 test/test_coercion.rb
flt-1.4.5 test/test_coercion.rb
flt-1.4.4 test/test_coercion.rb
flt-1.4.3 test/test_coercion.rb
flt-1.4.2 test/test_coercion.rb
flt-1.4.1 test/test_coercion.rb
flt-1.4.0 test/test_coercion.rb
flt-1.3.4 test/test_coercion.rb
flt-1.3.3 test/test_coercion.rb
flt-1.3.2 test/test_coercion.rb
flt-1.3.1 test/test_coercion.rb
flt-1.3.0 test/test_coercion.rb
flt-1.2.1 test/test_coercion.rb
flt-1.2.0 test/test_coercion.rb
flt-1.1.2 test/test_coercion.rb
flt-1.1.1 test/test_coercion.rb
flt-1.1.0 test/test_coercion.rb
flt-1.0.0 test/test_coercion.rb