From e77e1900d6f92fb8f987eaa7f8fc2806e7f0e69f Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Fri, 1 Mar 2002 14:17:54 +0000 Subject: [PATCH] Lost in the shuffle. p4raw-id: //depot/perl@14923 --- MANIFEST | 1 + lib/Math/BigInt/t/downgrade.t | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 lib/Math/BigInt/t/downgrade.t diff --git a/MANIFEST b/MANIFEST index 43a9e7d..33de6c2 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1144,6 +1144,7 @@ lib/Math/BigInt/t/bigintpm.t See if BigInt.pm works lib/Math/BigInt/t/calling.t Test calling conventions lib/Math/BigInt/t/config.t Test Math::BigInt->config() lib/Math/BigInt/t/constant.t Test Math::BigInt/BigFloat under :constant +lib/Math/BigInt/t/downgrade.t Test if use Math::BigInt(); under downgrade works lib/Math/BigInt/t/inf_nan.t Special tests for inf and NaN handling lib/Math/BigInt/t/mbimbf.inc Actual BigInt/BigFloat accuracy, precicion and fallback, round_mode tests lib/Math/BigInt/t/mbimbf.t BigInt/BigFloat accuracy, precicion and fallback, round_mode diff --git a/lib/Math/BigInt/t/downgrade.t b/lib/Math/BigInt/t/downgrade.t new file mode 100644 index 0000000..1309894 --- /dev/null +++ b/lib/Math/BigInt/t/downgrade.t @@ -0,0 +1,39 @@ +#!/usr/bin/perl -w + +use Test; +use strict; + +BEGIN + { + $| = 1; + unshift @INC, '../lib'; # for running manually + my $location = $0; $location =~ s/bigintpm.t//; + unshift @INC, $location; # to locate the testing files + chdir 't' if -d 't'; + plan tests => 10; + } + +use Math::BigInt; +use Math::BigFloat downgrade => 'Math::BigInt', upgrade => 'Math::BigInt'; + +use vars qw ($scale $class $try $x $y $f @args $ans $ans1 $ans1_str $setup + $ECL $CL); +$class = "Math::BigInt"; +$CL = "Math::BigInt::Calc"; +$ECL = "Math::BigFloat"; + +# simplistic test for now +ok (Math::BigFloat->downgrade(),'Math::BigInt'); +ok (Math::BigFloat->upgrade(),'Math::BigInt'); + +# these downgrade +ok (ref(Math::BigFloat->new('inf')),'Math::BigInt'); +ok (ref(Math::BigFloat->new('-inf')),'Math::BigInt'); +ok (ref(Math::BigFloat->new('NaN')),'Math::BigInt'); +ok (ref(Math::BigFloat->new('0')),'Math::BigInt'); +ok (ref(Math::BigFloat->new('1')),'Math::BigInt'); +ok (ref(Math::BigFloat->new('10')),'Math::BigInt'); +ok (ref(Math::BigFloat->new('-10')),'Math::BigInt'); +ok (ref(Math::BigFloat->new('-10.0E1')),'Math::BigInt'); + +#require 'upgrade.inc'; # all tests here for sharing -- 2.7.4