This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgraded Math::BigRat, Math::BigInt::FastCalc, Math::BigInt, & bignum
[perl5.git] / cpan / Math-BigRat / t / new-mbr.t
CommitLineData
7deec013
NB
1#!perl
2
3use strict;
4use warnings;
5
6use Test::More tests => 4;
7use Math::BigRat;
8
9use Scalar::Util qw< refaddr >;
10
11# CPAN RT #132712.
12
13my $q1 = Math::BigRat -> new("-1/2");
14my ($n, $d) = $q1 -> parts();
15
16my $n_orig = $n -> copy();
17my $d_orig = $d -> copy();
18my $q2 = Math::BigRat -> new($n, $d);
19
20cmp_ok($n, "==", $n_orig,
21 "The value of the numerator hasn't changed");
22cmp_ok($d, "==", $d_orig,
23 "The value of the denominator hasn't changed");
24
25isnt(refaddr($n), refaddr($n_orig),
26 "The addresses of the numerators have changed");
27isnt(refaddr($d), refaddr($d_orig),
28 "The addresses of the denominators have changed");