1--TEST--
2Test > operator : max int 32bit range
3--FILE--
4<?php
5
6define("MAX_64Bit", 9223372036854775807);
7define("MAX_32Bit", 2147483647);
8define("MIN_64Bit", -9223372036854775807 - 1);
9define("MIN_32Bit", -2147483647 - 1);
10
11$validGreaterThan = array (
12MAX_32Bit, array(MAX_32Bit - 1, "2147483646", "2147483646.999", 2.147483646e9, 2147483646.9, MIN_32Bit),
13-2147483647, array(MIN_32Bit, "-2147483648", "-2147483647.001", -2.1474836471e9, -2147483647.9),
14);
15
16$invalidGreaterThan = array (
17MAX_32Bit, array(2e33, MAX_32Bit + 1),
18MIN_32Bit, array(MIN_32Bit + 1, MAX_32Bit)
19);
20
21
22
23$failed = false;
24// test valid values
25for ($i = 0; $i < count($validGreaterThan); $i +=2) {
26   $typeToTestVal = $validGreaterThan[$i];
27   $compares = $validGreaterThan[$i + 1];
28   foreach($compares as $compareVal) {
29      if ($typeToTestVal > $compareVal) {
30         // do nothing
31      }
32      else {
33         echo "FAILED: '$typeToTestVal' <= '$compareVal'\n";
34         $failed = true;
35      }
36   }
37}
38// test for invalid values
39for ($i = 0; $i < count($invalidGreaterThan); $i +=2) {
40   $typeToTestVal = $invalidGreaterThan[$i];
41   $compares = $invalidGreaterThan[$i + 1];
42   foreach($compares as $compareVal) {
43      if ($typeToTestVal > $compareVal) {
44         echo "FAILED: '$typeToTestVal' > '$compareVal'\n";
45         $failed = true;
46      }
47   }
48}
49
50if ($failed == false) {
51   echo "Test Passed\n";
52}
53
54?>
55--EXPECT--
56Test Passed
57