summaryrefslogtreecommitdiff
path: root/cpan/Math-BigRat/t/new-mbr.t
diff options
context:
space:
mode:
Diffstat (limited to 'cpan/Math-BigRat/t/new-mbr.t')
-rw-r--r--cpan/Math-BigRat/t/new-mbr.t28
1 files changed, 28 insertions, 0 deletions
diff --git a/cpan/Math-BigRat/t/new-mbr.t b/cpan/Math-BigRat/t/new-mbr.t
new file mode 100644
index 0000000000..dad99428d1
--- /dev/null
+++ b/cpan/Math-BigRat/t/new-mbr.t
@@ -0,0 +1,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");