10 # compile time evaluation
12 if (int(1.234) == 1) {print "ok 1\n";} else {print "not ok 1\n";}
14 if (int(-1.234) == -1) {print "ok 2\n";} else {print "not ok 2\n";}
19 if (int($x) == 1) {print "ok 3\n";} else {print "not ok 3\n";}
20 if (int(-$x) == -1) {print "ok 4\n";} else {print "not ok 4\n";}
22 $x = length("abc") % -10;
23 print $x == -7 ? "ok 5\n" : "# expected -7, got $x\nnot ok 5\n";
27 $x = length("abc") % -10;
29 print $x+$y == 3 && abs($x) < 10 ? "ok 6\n" : "not ok 6\n";
32 # check bad strings still get converted
35 print "not " if $x["1foo"] != 8;
38 # check values > 32 bits work.
43 if ($y eq "4294967303") {
46 print "not ok 8 # int($x) is $y, not 4294967303\n"
51 if ($y eq "-4294967303") {
54 print "not ok 9 # int($x) is $y, not -4294967303\n"
60 if ($y eq "4294967294") {
63 print "not ok 10 # int($x) is $y, not 4294967294\n"
69 if ($y eq "4294967295") {
72 print "not ok 11 # int($x) is $y, not 4294967295\n"
75 $x = 4294967296.11312;
78 if ($y eq "4294967296") {
81 print "not ok 12 # int($x) is $y, not 4294967296\n"
84 $y = int(279964589018079/59);
85 if ($y == 4745162525730) {
88 print "not ok 13 # int(279964589018079/59) is $y, not 4745162525730\n"
93 if ($y == 4745162525730) {
96 print "not ok 14 # int(279964589018079/59) is $y, not 4745162525730\n"