diff options
author | Richard Leach <richardleach@users.noreply.github.com> | 2020-09-18 23:10:24 +0100 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2020-10-14 04:50:38 +0000 |
commit | 301e47857b2cb14a0bd3f64c79357afb34b383b2 (patch) | |
tree | 05a40fbbb7813b73d061fdc25c9fa597414677d1 /t | |
parent | 0818e8e292787681582b2ee3b24ff4e75022fa49 (diff) | |
download | perl-301e47857b2cb14a0bd3f64c79357afb34b383b2.tar.gz |
t/opbasic/arith.t - extra tests to better exercise dleft/dright paths in pp_modulo
Diffstat (limited to 't')
-rw-r--r-- | t/opbasic/arith.t | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/t/opbasic/arith.t b/t/opbasic/arith.t index 96b243b2c5..69ea784a02 100644 --- a/t/opbasic/arith.t +++ b/t/opbasic/arith.t @@ -10,7 +10,7 @@ BEGIN { # functions imported from t/test.pl or Test::More, as those programs/libraries # use operators which are what is being tested in this file. -print "1..186\n"; +print "1..189\n"; sub try ($$$) { print +($_[1] ? "ok" : "not ok") . " $_[0] - $_[2]\n"; @@ -45,6 +45,12 @@ tryeq $T++, -13 % 4, 3, 'modulo: negative positive'; tryeq $T++, 13 % -4, -3, 'modulo: positive negative'; tryeq $T++, -13 % -4, -1, 'modulo: negative negative'; +# Exercise some of the dright/dleft logic in pp_modulo + +tryeq $T++, 13.333333 % 5.333333, 3, 'modulo: 13.333333 % 5.333333'; +tryeq $T++, 13.333333 % 5, 3, 'modulo: 13.333333 % 5'; +tryeq $T++, 13 % 5.333333, 3, 'modulo: 13 % 5.333333'; + # Give abs() a good work-out before using it in anger tryeq $T++, abs(0), 0, 'abs(): 0 0'; tryeq $T++, abs(1), 1, 'abs(): 1 1'; |