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$validGtOrEqual = array (
16MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, MAX_32Bit - 1),
17MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, MIN_32Bit - 1),
18MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),
19MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),
20);
21
22$invalidGtOrEqual = array (
23MAX_32Bit, array("2147483648", 2.1474836470001e9, MAX_32Bit + 1),
24MIN_32Bit, array(MIN_32Bit + 1,"-2147483646", -2.1474836460001e9)
25);
26
27
28$failed = false;
29// test valid values
30for ($i = 0; $i < count($validGtOrEqual); $i +=2) {
31   $typeToTestVal = $validGtOrEqual[$i];
32   $compares = $validGtOrEqual[$i + 1];
33   foreach($compares as $compareVal) {
34      if ($typeToTestVal >= $compareVal) {
35         // do nothing
36      }
37      else {
38         echo "FAILED: '$typeToTestVal' < '$compareVal'\n";
39         $failed = true;
40      }
41   }
42}
43// test for invalid values
44for ($i = 0; $i < count($invalidGtOrEqual); $i +=2) {
45   $typeToTestVal = $invalidGtOrEqual[$i];
46   $compares = $invalidGtOrEqual[$i + 1];
47   foreach($compares as $compareVal) {
48      if ($typeToTestVal >= $compareVal) {
49         echo "FAILED: '$typeToTestVal' >= '$compareVal'\n";
50         $failed = true;
51      }
52   }
53}
54
55if ($failed == false) {
56   echo "Test Passed\n";
57}
58
59?>
60--EXPECT--
61Test Passed
62