summaryrefslogtreecommitdiff
path: root/cpan/Math-BigInt/t/sub_mbi.t
diff options
context:
space:
mode:
Diffstat (limited to 'cpan/Math-BigInt/t/sub_mbi.t')
-rw-r--r--cpan/Math-BigInt/t/sub_mbi.t34
1 files changed, 34 insertions, 0 deletions
diff --git a/cpan/Math-BigInt/t/sub_mbi.t b/cpan/Math-BigInt/t/sub_mbi.t
new file mode 100644
index 0000000000..b8e0a027ea
--- /dev/null
+++ b/cpan/Math-BigInt/t/sub_mbi.t
@@ -0,0 +1,34 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Test::More tests => 3649
+ + 5; # +5 own tests
+
+BEGIN { unshift @INC, 't'; }
+
+use Math::BigInt::Subclass;
+
+use vars qw ($class $try $x $y $f @args $ans $ans1 $ans1_str $setup $CL);
+$class = "Math::BigInt::Subclass";
+$CL = "Math::BigInt::Calc";
+
+my $version = '0.02'; # for $VERSION tests, match current release (by hand!)
+
+require 't/bigintpm.inc'; # perform same tests as bigintpm
+
+###############################################################################
+# Now do custom tests for Subclass itself
+
+my $ms = $class->new(23);
+print "# Missing custom attribute \$ms->{_custom}" if !is (1, $ms->{_custom});
+
+# Check that a subclass is still considered a BigInt
+isa_ok ($ms, 'Math::BigInt');
+
+use Math::BigInt;
+
+my $bi = Math::BigInt->new(23); # same as other
+$ms += $bi;
+print "# Tried: \$ms += \$bi, got $ms" if !is (46, $ms);
+print "# Missing custom attribute \$ms->{_custom}" if !is (1, $ms->{_custom});
+print "# Wrong class: ref(\$ms) was ".ref($ms) if !is ($class, ref($ms));