diff --git a/t/overload_cross_class.t b/t/overload_cross_class.t index 3d8764c..793d423 100755 --- a/t/overload_cross_class.t +++ b/t/overload_cross_class.t @@ -10,81 +10,73 @@ eval {require Math::MPFR;}; unless($@) { - if($Math::MPFR::VERSION <= 3.12) { - warn "\n Skipping tests - Math::MPFR version 3.13 (or later)\n" . + if($Math::MPFR::VERSION < 4.19) { + warn "\n Skipping tests - Math::MPFR version 4.19 (or later)\n" . " is needed. We have only version $Math::MPFR::VERSION\n"; print "ok 1\n"; } else { - if($Math::MPFR::VERSION >= 4.19) { - # Run the tests. - $op = Math::MPFR->new(100); - $op_pow = Math::MPFR->new(3.5); - $mpq = Math::GMPq->new(10075); - + # Run the tests. + $op = Math::MPFR->new(100); + $op_pow = Math::MPFR->new(3.5); + $mpq = Math::GMPq->new(10075); + + $rop = $mpq + $op; + if(ref($rop) eq 'Math::MPFR'){$ok .= 'a'} + else { warn "1a: ref: ", ref($rop), "\n"} + if($rop == 10175) {$ok .= 'b'} + else {warn "1b: \$rop: $rop\n"} + + $rop = $mpq * $op; + if(ref($rop) eq 'Math::MPFR'){$ok .= 'c'} + else { warn "1c: ref: ", ref($rop), "\n"} + if($rop == 1007500) {$ok .= 'd'} + else {warn "1d: \$rop: $rop\n"} + + $rop = $mpq - $op; + if(ref($rop) eq 'Math::MPFR'){$ok .= 'e'} + else { warn "1e: ref: ", ref($rop), "\n"} + if($rop == 9975) {$ok .= 'f'} + else {warn "1f: \$rop: $rop\n"} + + $rop = $mpq / $op; + if(ref($rop) eq 'Math::MPFR'){$ok .= 'g'} + else { warn "1g: ref: ", ref($rop), "\n"} + if($rop == 100.75) {$ok .= 'h'} + else {warn "1h: \$rop: $rop\n"} + + $mpq /= 100; + $mpq -= 0.75; + + $rop = $mpq ** $op_pow; + if(ref($rop) eq 'Math::MPFR'){$ok .= 'i'} + else { warn "1i: ref: ", ref($rop), "\n"} + if($rop == 10000000) {$ok .= 'j'} + else {warn "1j: \$rop: $rop\n"} + + my $ccount = Math::GMPq::_wrap_count(); + + for(1..100) { $rop = $mpq + $op; - if(ref($rop) eq 'Math::MPFR'){$ok .= 'a'} - else { warn "1a: ref: ", ref($rop), "\n"} - if($rop == 10175) {$ok .= 'b'} - else {warn "1b: \$rop: $rop\n"} - - $rop = $mpq * $op; - if(ref($rop) eq 'Math::MPFR'){$ok .= 'c'} - else { warn "1c: ref: ", ref($rop), "\n"} - if($rop == 1007500) {$ok .= 'd'} - else {warn "1d: \$rop: $rop\n"} - $rop = $mpq - $op; - if(ref($rop) eq 'Math::MPFR'){$ok .= 'e'} - else { warn "1e: ref: ", ref($rop), "\n"} - if($rop == 9975) {$ok .= 'f'} - else {warn "1f: \$rop: $rop\n"} - + $rop = $mpq * $op; $rop = $mpq / $op; - if(ref($rop) eq 'Math::MPFR'){$ok .= 'g'} - else { warn "1g: ref: ", ref($rop), "\n"} - if($rop == 100.75) {$ok .= 'h'} - else {warn "1h: \$rop: $rop\n"} + $rop = $mpq ** $op_pow; + } - $mpq /= 100; - $mpq -= 0.75; + my $ncount = Math::GMPq::_wrap_count(); - $rop = $mpq ** $op_pow; - if(ref($rop) eq 'Math::MPFR'){$ok .= 'i'} - else { warn "1i: ref: ", ref($rop), "\n"} - if($rop == 10000000) {$ok .= 'j'} - else {warn "1j: \$rop: $rop\n"} - - my $ccount = Math::GMPq::_wrap_count(); - - for(1..100) { - $rop = $mpq + $op; - $rop = $mpq - $op; - $rop = $mpq * $op; - $rop = $mpq / $op; - $rop = $mpq ** $op_pow; - } - - my $ncount = Math::GMPq::_wrap_count(); - - if($ccount == $ncount) {$ok .= 'k'} - else { - warn "1k: \$ccount: $ccount \$ncount: $ncount\n"; - warn "Looks like we have a memory leak\n" if $ncount > $ccount; - } - - if($ok eq 'abcdefghijk') {print "ok 1\n"} - else { - warn "\$ok: $ok\n"; - print "not ok 1\n"; - } + if($ccount == $ncount) {$ok .= 'k'} + else { + warn "1k: \$ccount: $ccount \$ncount: $ncount\n"; + warn "Looks like we have a memory leak\n" if $ncount > $ccount; } + + if($ok eq 'abcdefghijk') {print "ok 1\n"} else { - warn "\nSkipping all tests, as some of these tests will fail.\n"; - warn "Math-MPFR-4.19 or later is needed for all tests to PASS\n"; - warn "We have only version $Math::MPFR::VERSION"; - print "ok 1\n"; + warn "\$ok: $ok\n"; + print "not ok 1\n"; } } }