blob: f59115e760ba2517e4117b91dcc5854ffc204394 (
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
#!./perl
print "1..12\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";}
$a = 2147483648;
$a = -$a;
$c=$a--;
if ($a == -2147483649)
{print "ok 7\n"}
else
{print "not ok 7\n";}
$a = 2147483648;
$a = -$a;
$c=--$a;
if ($a == -2147483649)
{print "ok 8\n"}
else
{print "not ok 8\n";}
$a = 2147483648;
$a = -$a;
$a=$a-1;
if ($a == -2147483649)
{print "ok 9\n"}
else
{print "not ok 9\n";}
$a = 2147483648;
$b = -$a;
$c=$b--;
if ($b == -$a-1)
{print "ok 10\n"}
else
{print "not ok 10\n";}
$a = 2147483648;
$b = -$a;
$c=--$b;
if ($b == -$a-1)
{print "ok 11\n"}
else
{print "not ok 11\n";}
$a = 2147483648;
$b = -$a;
$b=$b-1;
if ($b == -(++$a))
{print "ok 12\n"}
else
{print "not ok 12\n";}
|