This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Document string- and number-specific bitops in perlop
[perl5.git] / dist / Math-BigInt / t / isa.t
CommitLineData
da687c2a
JH
1#!/usr/bin/perl -w
2
da687c2a 3use strict;
3167abe5 4use Test::More tests => 7;
da687c2a 5
3167abe5 6BEGIN { unshift @INC, 't'; }
da687c2a
JH
7
8use Math::BigInt::Subclass;
9use Math::BigFloat::Subclass;
10use Math::BigInt;
11use Math::BigFloat;
12
13use vars qw ($class $try $x $y $f @args $ans $ans1 $ans1_str $setup $CL);
14$class = "Math::BigInt::Subclass";
15$CL = "Math::BigInt::Calc";
16
17# Check that a subclass is still considered a BigInt
3167abe5 18isa_ok ($class->new(123), 'Math::BigInt');
da687c2a
JH
19
20# ditto for plain Math::BigInt
3167abe5 21isa_ok (Math::BigInt->new(123), 'Math::BigInt');
da687c2a
JH
22
23# But Math::BigFloats aren't
3167abe5 24isnt (Math::BigFloat->new(123)->isa('Math::BigInt'), 1);
da687c2a
JH
25
26# see what happens if we feed a Math::BigFloat into new()
27$x = Math::BigInt->new(Math::BigFloat->new(123));
3167abe5
NC
28is (ref($x),'Math::BigInt');
29isa_ok ($x, 'Math::BigInt');
da687c2a
JH
30
31# ditto for subclass
32$x = Math::BigInt->new(Math::BigFloat->new(123));
3167abe5
NC
33is (ref($x),'Math::BigInt');
34isa_ok ($x, 'Math::BigInt');