X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Farith.t;h=890c78f3c4847c20fa83366b83ff2cd8e1144087;hb=5479d1922c9c0436fce71aca57c0f7e68ece0b49;hp=2847acb05f23277e86c51a242933e7c5ea06b63e;hpb=b82d478d407f1381d69179104035c975c1d1402e;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/arith.t b/t/op/arith.t index 2847acb..890c78f 100755 --- a/t/op/arith.t +++ b/t/op/arith.t @@ -1,6 +1,6 @@ #!./perl -w -print "1..109\n"; +print "1..130\n"; sub try ($$) { print +($_[1] ? "ok" : "not ok"), " $_[0]\n"; @@ -204,3 +204,36 @@ tryeq 106, 46339 * 46341, 0x7ffea80f; tryeq 107, 46339 * -46341, -0x7ffea80f; tryeq 108, -46339 * 46341, -0x7ffea80f; tryeq 109, -46339 * -46341, 0x7ffea80f; + +# leading space should be ignored + +tryeq 110, 1 + " 1", 2; +tryeq 111, 3 + " -1", 2; +tryeq 112, 1.2, " 1.2"; +tryeq 113, -1.2, " -1.2"; + +# divide + +tryeq 114, 28/14, 2; +tryeq 115, 28/-7, -4; +tryeq 116, -28/4, -7; +tryeq 117, -28/-2, 14; + +tryeq 118, 0x80000000/1, 0x80000000; +tryeq 119, 0x80000000/-1, -0x80000000; +tryeq 120, -0x80000000/1, -0x80000000; +tryeq 121, -0x80000000/-1, 0x80000000; + +# The example for sloppy divide, rigged to avoid the peephole optimiser. +tryeq 122, "20." / "5.", 4; + +tryeq 123, 2.5 / 2, 1.25; +tryeq 124, 3.5 / -2, -1.75; +tryeq 125, -4.5 / 2, -2.25; +tryeq 126, -5.5 / -2, 2.75; + +# Bluuurg if your floating point can't accurately cope with powers of 2 +tryeq 127, 18446744073709551616/1, 18446744073709551616; +tryeq 128, 18446744073709551616/2, 9223372036854775808; +tryeq 129, 18446744073709551616/4294967296, 4294967296; +tryeq 130, 18446744073709551616/9223372036854775808, 2;