summaryrefslogtreecommitdiffstats
path: root/contrib/perl5/t/op/inc.t
blob: e5a2a921b3f929e638b7bd945198e91234bfb20e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!./perl


# $RCSfile$

print "1..6\n";

# Verify that addition/subtraction properly upgrade to doubles.
# These tests are only significant on machines with 32 bit longs,
# and two's complement negation, but shouldn't fail anywhere.

$a = 2147483647;
$c=$a++;
if ($a == 2147483648) 
	{print "ok 1\n"}
else
	{print "not ok 1\n";}

$a = 2147483647;
$c=++$a;
if ($a == 2147483648) 
	{print "ok 2\n"}
else
	{print "not ok 2\n";}

$a = 2147483647;
$a=$a+1;
if ($a == 2147483648) 
	{print "ok 3\n"}
else
	{print "not ok 3\n";}

$a = -2147483648;
$c=$a--;
if ($a == -2147483649) 
	{print "ok 4\n"}
else
	{print "not ok 4\n";}

$a = -2147483648;
$c=--$a;
if ($a == -2147483649) 
	{print "ok 5\n"}
else
	{print "not ok 5\n";}

$a = -2147483648;
$a=$a-1;
if ($a == -2147483649) 
	{print "ok 6\n"}
else
	{print "not ok 6\n";}
OpenPOWER on IntegriCloud