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