1# -*- mode: perl; -*-
2
3use strict;
4use warnings;
5
6use Test::More tests => 899             # tests in require'd file
7                        + 9;            # tests in this file
8
9use lib 't';
10
11use Math::BigRat::Subclass;
12
13our ($CLASS, $LIB);
14$CLASS = "Math::BigRat::Subclass";
15$LIB   = $CLASS -> config('lib');       # backend library
16
17require './t/bigratpm.inc';
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 a subclass is still considered a Math::BigRat
26isa_ok($ms, 'Math::BigRat');
27
28my $bi = Math::BigRat -> new(23);         # same as other
29$ms += $bi;
30is($ms, 46, '$ms is 46');
31is($ms->{_custom}, 1, '$ms has custom attribute $ms->{_custom}');
32is(ref($ms), $CLASS, "\$ms is not an object of class '$CLASS'");
33
34is($CLASS -> accuracy(), undef,
35   "$CLASS gets 'accuracy' from parent");
36
37is($CLASS -> precision(), undef,
38   "$CLASS gets 'precision' from parent");
39
40cmp_ok($CLASS -> div_scale(), "==", 40,
41       "$CLASS gets 'div_scale' from parent");
42
43is($CLASS -> round_mode(), "even",
44   "$CLASS gets 'round_mode' from parent");
45