Commit | Line | Data |
---|---|---|
ee15d750 JH |
1 | #!/usr/bin/perl -w |
2 | ||
ee15d750 | 3 | use strict; |
6358232b | 4 | use Test::More tests => 3651 |
07d34614 | 5 | + 5; # +5 own tests |
3167abe5 NC |
6 | |
7 | BEGIN { unshift @INC, 't'; } | |
ee15d750 | 8 | |
dccbb853 | 9 | use Math::BigInt::Subclass; |
ee15d750 | 10 | |
394e6ffb | 11 | use vars qw ($class $try $x $y $f @args $ans $ans1 $ans1_str $setup $CL); |
dccbb853 | 12 | $class = "Math::BigInt::Subclass"; |
394e6ffb | 13 | $CL = "Math::BigInt::Calc"; |
dccbb853 | 14 | |
394e6ffb | 15 | my $version = '0.02'; # for $VERSION tests, match current release (by hand!) |
ee15d750 | 16 | |
4aa37faf | 17 | require 't/bigintpm.inc'; # perform same tests as bigintpm |
ee15d750 | 18 | |
9393ace2 | 19 | ############################################################################### |
ee15d750 | 20 | # Now do custom tests for Subclass itself |
d5735945 | 21 | |
dccbb853 | 22 | my $ms = $class->new(23); |
3167abe5 | 23 | print "# Missing custom attribute \$ms->{_custom}" if !is (1, $ms->{_custom}); |
ee15d750 | 24 | |
9393ace2 | 25 | # Check that a subclass is still considered a BigInt |
3167abe5 | 26 | isa_ok ($ms, 'Math::BigInt'); |
9393ace2 | 27 | |
dccbb853 | 28 | use Math::BigInt; |
ee15d750 | 29 | |
dccbb853 JH |
30 | my $bi = Math::BigInt->new(23); # same as other |
31 | $ms += $bi; | |
3167abe5 NC |
32 | print "# Tried: \$ms += \$bi, got $ms" if !is (46, $ms); |
33 | print "# Missing custom attribute \$ms->{_custom}" if !is (1, $ms->{_custom}); | |
34 | print "# Wrong class: ref(\$ms) was ".ref($ms) if !is ($class, ref($ms)); |