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