Sha256: d4ad09c5a39a8ca3e860e695bea38397b54115586c9aa1110ff3976f844cf603

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))

class TC_Z_ExportImport < Test::Unit::TestCase
  def setup
    @a = GMP::Z.new(3)**40
  end

  def test_export_import_identity
    assert_equal(@a, GMP::Z.import(@a.export),         "An integer should export and then import to itself")
    assert_equal(@a, GMP::Z.import(@a.export(-1)),     "An integer should export and then import to itself")
    assert_equal(@a, GMP::Z.import(@a.export, -1),     "An integer should export and then import to itself")
    assert_equal(@a, GMP::Z.import(@a.export(-1), -1), "An integer should export and then import to itself")
  end

  def test_export_import_order
    assert_equal(@a, GMP::Z.import(@a.export(1), 1), "An integer should export and then import to itself")

    assert_false(@a == GMP::Z.import(@a.export( 1), -1), "An integer exported one way and then imported should not be equal")
    assert_false(@a == GMP::Z.import(@a.export(-1),  1), "An integer exported one way and then imported should not be equal")
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gmp-0.6.47 test/tc_z_export_import.rb
gmp-0.6.43 test/tc_z_export_import.rb
gmp-0.6.41 test/tc_z_export_import.rb
gmp-0.6.31 test/tc_z_export_import.rb
gmp-0.6.19 test/tc_z_export_import.rb