1--TEST--
2Test < operator : max int 64bit range
3--SKIPIF--
4<?php
5if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
6?>
7--FILE--
8<?php
9
10define("MAX_64Bit", 9223372036854775807);
11define("MAX_32Bit", 2147483647);
12define("MIN_64Bit", -9223372036854775807 - 1);
13define("MIN_32Bit", -2147483647 - 1);
14
15$validLessThan = array (
162147483646, array(MAX_32Bit, "2147483647", "2147483647.001", 2.147483647e9, 2147483647.9),
17MIN_32Bit, array(MIN_32Bit + 1, "-2147483647", "-2147483646.001", -2.1474836461e9, -2147483646.9),
18);
19
20$invalidLessThan = array (
21MAX_32Bit, array("2147483646", 2.1474836460001e9, MAX_32Bit - 1),
22MIN_32Bit, array(MIN_32Bit - 1, "-2147483649", -2.1474836480001e9)
23);
24
25$failed = false;
26// test for equality
27for ($i = 0; $i < count($validLessThan); $i +=2) {
28   $typeToTestVal = $validLessThan[$i];
29   $compares = $validLessThan[$i + 1];
30   foreach($compares as $compareVal) {
31      if ($typeToTestVal < $compareVal) {
32         // do nothing
33      }
34      else {
35         echo "FAILED: '$typeToTestVal' >= '$compareVal'\n";
36         $failed = true;
37      }
38   }
39}
40// test for invalid values
41for ($i = 0; $i < count($invalidLessThan); $i +=2) {
42   $typeToTestVal = $invalidLessThan[$i];
43   $compares = $invalidLessThan[$i + 1];
44   foreach($compares as $compareVal) {
45      if ($typeToTestVal < $compareVal) {
46         echo "FAILED: '$typeToTestVal' < '$compareVal'\n";
47         $failed = true;
48      }
49   }
50}
51
52if ($failed == false) {
53   echo "Test Passed\n";
54}
55
56?>
57===DONE===
58--EXPECT--
59Test Passed
60===DONE===