1--TEST--
2Test > operator : max int 32bit range
3--SKIPIF--
4<?php
5if (PHP_INT_SIZE != 4) die("skip this test is for 32bit 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$validGreaterThan = array (
16MAX_32Bit, array(MAX_32Bit - 1, "2147483646", "2147483646.999", 2.147483646e9, 2147483646.9, MIN_32Bit),
17-2147483647, array(MIN_32Bit, "-2147483648", "-2147483647.001", -2.1474836471e9, -2147483647.9),
18);
19
20$invalidGreaterThan = array (
21MAX_32Bit, array(2e33, MAX_32Bit + 1),
22MIN_32Bit, array(MIN_32Bit + 1, MAX_32Bit)
23);
24
25
26
27$failed = false;
28// test valid values
29for ($i = 0; $i < count($validGreaterThan); $i +=2) {
30   $typeToTestVal = $validGreaterThan[$i];
31   $compares = $validGreaterThan[$i + 1];
32   foreach($compares as $compareVal) {
33      if ($typeToTestVal > $compareVal) {
34         // do nothing
35      }
36      else {
37         echo "FAILED: '$typeToTestVal' <= '$compareVal'\n";
38         $failed = true;
39      }
40   }
41}
42// test for invalid values
43for ($i = 0; $i < count($invalidGreaterThan); $i +=2) {
44   $typeToTestVal = $invalidGreaterThan[$i];
45   $compares = $invalidGreaterThan[$i + 1];
46   foreach($compares as $compareVal) {
47      if ($typeToTestVal > $compareVal) {
48         echo "FAILED: '$typeToTestVal' > '$compareVal'\n";
49         $failed = true;
50      }
51   }
52}
53
54if ($failed == false) {
55   echo "Test Passed\n";
56}
57
58?>
59===DONE===
60--EXPECT--
61Test Passed
62===DONE===