Commit | Line | Data |
---|---|---|
7deec013 NB |
1 | #!perl |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | ||
6 | use Test::More tests => 4; | |
7 | use Math::BigRat; | |
8 | ||
9 | use Scalar::Util qw< refaddr >; | |
10 | ||
11 | # CPAN RT #132712. | |
12 | ||
13 | my $q1 = Math::BigRat -> new("-1/2"); | |
14 | my ($n, $d) = $q1 -> parts(); | |
15 | ||
16 | my $n_orig = $n -> copy(); | |
17 | my $d_orig = $d -> copy(); | |
18 | my $q2 = Math::BigRat -> new($n, $d); | |
19 | ||
20 | cmp_ok($n, "==", $n_orig, | |
21 | "The value of the numerator hasn't changed"); | |
22 | cmp_ok($d, "==", $d_orig, | |
23 | "The value of the denominator hasn't changed"); | |
24 | ||
25 | isnt(refaddr($n), refaddr($n_orig), | |
26 | "The addresses of the numerators have changed"); | |
27 | isnt(refaddr($d), refaddr($d_orig), | |
28 | "The addresses of the denominators have changed"); |