1N/A chdir 't' if -d 't'; 1N/A# compile time evaluation 1N/Aif (int(1.234) == 1) {
print "ok 1\n";}
else {
print "not ok 1\n";}
1N/Aif (int(-1.234) == -1) {
print "ok 2\n";}
else {
print "not ok 2\n";}
1N/A# run time evaluation 1N/Aif (int($x) == 1) {
print "ok 3\n";}
else {
print "not ok 3\n";}
1N/Aif (int(-$x) == -1) {
print "ok 4\n";}
else {
print "not ok 4\n";}
1N/Aprint $x == -
7 ?
"ok 5\n" :
"# expected -7, got $x\nnot ok 5\n";
1N/A print $x+$y == 3 && abs($x) < 10 ? "ok 6\n" : "not ok 6\n"; 1N/A# check bad strings still get converted 1N/Aprint "not " if $x[
"1foo"] !=
8;
1N/A# check values > 32 bits work. 1N/A print "not ok 8 # int($x) is $y, not 4294967303\n" 1N/Aif ($y eq "-4294967303") { 1N/A print "not ok 9 # int($x) is $y, not -4294967303\n" 1N/A print "not ok 10 # int($x) is $y, not 4294967294\n" 1N/A print "not ok 11 # int($x) is $y, not 4294967295\n" 1N/A$x =
4294967296.11312;
1N/A print "not ok 12 # int($x) is $y, not 4294967296\n" 1N/A$y =
int(279964589018079/59);
1N/Aif ($y == 4745162525730) { 1N/A print "not ok 13 # int(279964589018079/59) is $y, not 4745162525730\n" 1N/A$y =
279964589018079;
1N/Aif ($y == 4745162525730) { 1N/A print "not ok 14 # int(279964589018079/59) is $y, not 4745162525730\n"