Sha256: bdc8e308de5c977b4108d073612b825d3780ae31cf033629d50f26016f03fbd0
Contents?: true
Size: 739 Bytes
Versions: 3
Compression:
Stored size: 739 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,n), n.send(op,n) end end end.each do |name,op| define_method "test_#{name}_as_rval" do data = [ 0, 1, Math::PI, BigDecimal.new("123.5813") ] data.each do |n| d = n.to_dec_number assert_equal n.send(op,d), n.send(op,n) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dec_number-0.2.1 | test/test_dec_number.rb |
dec_number-0.2.0 | test/test_dec_number.rb |
dec_number-0.1.6 | test/test_dec_number.rb |