summaryrefslogtreecommitdiffstats
path: root/t/13_drhtz-drhfz.t
diff options
context:
space:
mode:
Diffstat (limited to 't/13_drhtz-drhfz.t')
-rw-r--r--t/13_drhtz-drhfz.t15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/13_drhtz-drhfz.t b/t/13_drhtz-drhfz.t
index fc8ee01..284f97e 100644
--- a/t/13_drhtz-drhfz.t
+++ b/t/13_drhtz-drhfz.t
@@ -24,6 +24,7 @@ use Math::Decimal::FastPP;
my @std_tests;
my @tie_tests;
+my @inv_tests;
my $i;
my $a;
my $p;
@@ -43,6 +44,7 @@ my $f;
[ -2.39, 1, "-2.4", \&drhtz, \&drhfz],
);
@tie_tests = (
+ # a p r functions
[ 23.5 , 0, "23." , \&drhtz ],
[ 23.5 , 0, "24." , \&drhfz],
[ 2.35, 1, "2.3", \&drhtz ],
@@ -52,10 +54,15 @@ my $f;
[ -2.35, 1, "-2.3", \&drhtz ],
[ -2.35, 1, "-2.4", \&drhfz],
);
+@inv_tests = (
+ # a p r functions
+ [ 23 , 1, undef, \&drhtz, \&drhfz],
+);
$i = 0;
map({$i += scalar(@{$_}) - 3} @std_tests);
map({$i += scalar(@{$_}) - 3} @tie_tests);
+map({$i += scalar(@{$_}) - 3} @inv_tests);
plan("tests" => $i);
note("Basic tests:");
@@ -74,3 +81,11 @@ foreach (@tie_tests) {
svref_2object($f)->GV->NAME, $a, $p, $r));
}
}
+note("Invalid precision tests:");
+foreach (@inv_tests) {
+ ($a, $p, $r, @funcs) = @{$_};
+ foreach $f (@funcs) {
+ is(&$f($a, $p), $r, sprintf("%s(%s, %d) = undef",
+ svref_2object($f)->GV->NAME, $a, $p));
+ }
+}