diff options
author | P. J. McDermott <pj@pehjota.net> | 2017-01-05 17:51:18 (EST) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2017-01-05 17:51:18 (EST) |
commit | 5e98e05cf739535901b4c7af69371a0bec6a0a39 (patch) | |
tree | 591ed202481c6bcbeba31fce11da46d77c3d1865 | |
parent | 488761b68019aa2b73b69323757049fe2889cfcf (diff) | |
download | Math-Decimal-FastPP-5e98e05cf739535901b4c7af69371a0bec6a0a39.zip Math-Decimal-FastPP-5e98e05cf739535901b4c7af69371a0bec6a0a39.tar.gz Math-Decimal-FastPP-5e98e05cf739535901b4c7af69371a0bec6a0a39.tar.bz2 |
t/13_drhtz-drhfz.t: Test invalid precision
drhtz() and drhfz() are now at 100% test coverage.
-rw-r--r-- | t/13_drhtz-drhfz.t | 15 |
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)); + } +} |