summaryrefslogtreecommitdiff
path: root/cpan/Math-BigRat/t/new-mbr.t
blob: dad99428d1f75cd2a26766f35885662d0b19e4db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!perl

use strict;
use warnings;

use Test::More tests => 4;
use Math::BigRat;

use Scalar::Util qw< refaddr >;

# CPAN RT #132712.

my $q1 = Math::BigRat -> new("-1/2");
my ($n, $d) = $q1 -> parts();

my $n_orig = $n -> copy();
my $d_orig = $d -> copy();
my $q2 = Math::BigRat -> new($n, $d);

cmp_ok($n, "==", $n_orig,
       "The value of the numerator hasn't changed");
cmp_ok($d, "==", $d_orig,
       "The value of the denominator hasn't changed");

isnt(refaddr($n), refaddr($n_orig),
     "The addresses of the numerators have changed");
isnt(refaddr($d), refaddr($d_orig),
     "The addresses of the denominators have changed");