Return to bindec_basiclong_64bit.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / math |
1.1 misho 1: --TEST-- 2: Test bindec function : 64bit long tests 3: --SKIPIF-- 4: <?php 5: if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); 6: ?> 7: --FILE-- 8: <?php 9: 10: define("MAX_64Bit", 9223372036854775807); 11: define("MAX_32Bit", 2147483647); 12: define("MIN_64Bit", -9223372036854775807 - 1); 13: define("MIN_32Bit", -2147483647 - 1); 14: 15: $binLongStrs = array( 16: '0'.str_repeat('1',63), 17: str_repeat('1',64), 18: '0'.str_repeat('1',31), 19: str_repeat('1',32), 20: '0'.str_repeat('1',64), 21: str_repeat('1',65), 22: '0'.str_repeat('1',32), 23: str_repeat('1',33) 24: ); 25: 26: 27: foreach ($binLongStrs as $strVal) { 28: echo "--- testing: $strVal ---\n"; 29: var_dump(bindec($strVal)); 30: } 31: 32: ?> 33: ===DONE=== 34: --EXPECT-- 35: --- testing: 0111111111111111111111111111111111111111111111111111111111111111 --- 36: int(9223372036854775807) 37: --- testing: 1111111111111111111111111111111111111111111111111111111111111111 --- 38: float(1.844674407371E+19) 39: --- testing: 01111111111111111111111111111111 --- 40: int(2147483647) 41: --- testing: 11111111111111111111111111111111 --- 42: int(4294967295) 43: --- testing: 01111111111111111111111111111111111111111111111111111111111111111 --- 44: float(1.844674407371E+19) 45: --- testing: 11111111111111111111111111111111111111111111111111111111111111111 --- 46: float(3.6893488147419E+19) 47: --- testing: 011111111111111111111111111111111 --- 48: int(4294967295) 49: --- testing: 111111111111111111111111111111111 --- 50: int(8589934591) 51: ===DONE===