1# -*- mode: perl; -*-
2
3use strict;
4use warnings;
5
6use Test::More tests => 3070            # tests in require'd file
7                         + 8;           # tests in this file
8
9use lib 't';
10
11use Math::BigFloat::Subclass;
12
13our ($CLASS, $LIB);
14$CLASS = "Math::BigFloat::Subclass";
15$LIB   = Math::BigFloat->config('lib');         # backend library
16
17require './t/bigfltpm.inc';     # perform same tests as bigfltpm
18
19###############################################################################
20# Now do custom tests for Subclass itself
21
22my $ms = $CLASS->new(23);
23is($ms->{_custom}, 1, '$ms has custom attribute \$ms->{_custom}');
24
25# Check that subclass is a Math::BigFloat, but not a Math::Bigint
26isa_ok($ms, 'Math::BigFloat');
27ok(!$ms->isa('Math::BigInt'),
28   "An object of class '" . ref($ms) . "' isn't a 'Math::BigFloat'");
29
30use Math::BigFloat;
31
32my $bf = Math::BigFloat->new(23);       # same as other
33$ms += $bf;
34is($ms, 46, '$ms is 46');
35is($ms->{_custom}, 1, '$ms has custom attribute $ms->{_custom}');
36is(ref($ms), $CLASS, "\$ms is not an object of class '$CLASS'");
37
38cmp_ok(Math::BigFloat::Subclass -> div_scale(), "==", 40,
39      "Math::BigFloat::Subclass gets 'div_scale' from parent");
40
41is(Math::BigFloat::Subclass -> round_mode(), "even",
42   "Math::BigFloat::Subclass gets 'round_mode' from parent");
43