1eac174f2Safresh1# -*- mode: perl; -*-
2b8851fccSafresh1
3b8851fccSafresh1use strict;
4b8851fccSafresh1use warnings;
5b8851fccSafresh1
6*e0680481Safresh1use Test::More tests => 4278            # tests in require'd file
7eac174f2Safresh1                         + 7;           # tests in this file
8b8851fccSafresh1
9b8851fccSafresh1use lib 't';
10b8851fccSafresh1
11b8851fccSafresh1use Math::BigInt::Subclass;
12b8851fccSafresh1
13b46d8ef2Safresh1our ($CLASS, $LIB);
14b8851fccSafresh1$CLASS = "Math::BigInt::Subclass";
15b46d8ef2Safresh1$LIB   = "Math::BigInt::Calc";          # backend
16b8851fccSafresh1
17b46d8ef2Safresh1require './t/bigintpm.inc';             # perform same tests as bigintpm
18b8851fccSafresh1
19b8851fccSafresh1###############################################################################
20b8851fccSafresh1# Now do custom tests for Subclass itself
21b8851fccSafresh1
22b8851fccSafresh1my $ms = $CLASS->new(23);
23b8851fccSafresh1is($ms->{_custom}, 1, '$ms has custom attribute \$ms->{_custom}');
24b8851fccSafresh1
25b8851fccSafresh1# Check that a subclass is still considered a Math::BigInt
26b8851fccSafresh1isa_ok($ms, 'Math::BigInt');
27b8851fccSafresh1
28b8851fccSafresh1use Math::BigInt;
29b8851fccSafresh1
30b8851fccSafresh1my $bi = Math::BigInt->new(23);         # same as other
31b8851fccSafresh1$ms += $bi;
32b8851fccSafresh1is($ms, 46, '$ms is 46');
33b8851fccSafresh1is($ms->{_custom}, 1, '$ms has custom attribute $ms->{_custom}');
34b8851fccSafresh1is(ref($ms), $CLASS, "\$ms is not an object of class '$CLASS'");
35eac174f2Safresh1
36eac174f2Safresh1cmp_ok(Math::BigInt::Subclass -> div_scale(), "==", 40,
37eac174f2Safresh1      "Math::BigInt::Subclass gets 'div_scale' from parent");
38eac174f2Safresh1
39eac174f2Safresh1is(Math::BigInt::Subclass -> round_mode(), "even",
40eac174f2Safresh1   "Math::BigInt::Subclass gets 'round_mode' from parent");
41