Sha256: feb23e452b4efb8ccb604b9c72c0431578f4d5475ab8a757a4d4d8e1be5a9bbe

Contents?: true

Size: 864 Bytes

Versions: 14

Compression:

Stored size: 864 Bytes

Contents

require 'test_helper'

class TC_to_i_to_d < Test::Unit::TestCase
  def setup
    @a = GMP::Z.new(100)
    #@b = GMP::Z.pow(2,32)
    @c = GMP::Q.new(200,11)
  end
  
  def test_to_i
    assert_equal(@a.to_i, 100, "GMP::Z should to_i correctly.")
    assert_equal(@a.to_i.class, Fixnum, "GMP::Z.to_i should be a Fixnum.")
    #assert_equal(@b.to_i, 2**32, "GMP::Z (Bignum) should to_i correctly.")
    #assert_equal(@b.to_i.class, Bignum, "GMP::Z.to_i should be a Bignum.")
  end
  
  def test_to_d
    assert_equal(@a.to_d, 100.0, "GMP::Z should to_d correctly.")
    assert_equal(@a.to_d.class, Float, "GMP::Z.to_d should be a Float.")
    #assert_equal(@b.to_d, 2**32*1.0, "GMP::Z should to_d correctly.")
    #assert_equal(@b.to_d.class, Float, "GMP::Z.to_d should be a Float.")
    assert_equal(@c.to_d.class, Float, "GMP::Q.to_d should be a Float.")
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
gmp-0.4.7-x86_64-linux test/tc_z_to_d_to_i.rb
gmp-0.4.7 test/tc_z_to_d_to_i.rb
gmp-0.4.7-x86-mingw32 test/tc_z_to_d_to_i.rb
gmp-0.4.3 test/tc_z_to_d_to_i.rb
gmp-0.4.3-x86-mingw32 test/tc_z_to_d_to_i.rb
gmp-0.4.1-x86-mingw32 test/tc_z_to_d_to_i.rb
gmp-0.4.1 test/tc_z_to_d_to_i.rb
gmp-0.4.0-x86-mingw32 test/tc_z_to_d_to_i.rb
gmp-0.4.0 test/tc_z_to_d_to_i.rb
gmp-0.2.2 test/tc_z_to_d_to_i.rb
gmp-0.2.1 test/tc_z_to_d_to_i.rb
gmp-0.1.9 test/tc_z_to_d_to_i.rb
gmp-0.1.8 test/tc_z_to_d_to_i.rb
gmp-0.1.7 test/tc_z_to_d_to_i.rb