Sha256: 92cb92bdf41dce36cd0510e33492370af01c1168f0aa9aa3662b4678b9fe5526

Contents?: true

Size: 494 Bytes

Versions: 4

Compression:

Stored size: 494 Bytes

Contents

require 'test/unit'
$: << File.join(File.dirname(__FILE__), '..', 'ext', 'dec_number')
require 'dec_number'
require 'bigdecimal'

class TestDecNumber < Test::Unit::TestCase
  [ [ "addition", :+ ],
    [ "subtraction", :- ],
    [ "equality", :== ]
  ].each do |name,op|
    define_method "test_#{name}" do
      data = [ 0, 1, Math::PI, BigDecimal.new("123.5813") ]
      data.each do |n|
        d = n.to_dec_number
        assert_equal d.send(op,d), n.send(op,n)
      end
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dec_number-0.1.5 test/test_dec_number.rb
dec_number-0.1.4 test/test_dec_number.rb
dec_number-0.1.3 test/test_dec_number.rb
dec_number-0.1.2 test/test_dec_number.rb