File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / lang / operators / postinc_basiclong_64bit.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:06 2012 UTC (12 years, 4 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

    1: --TEST--
    2: Test N++ operator : 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: $longVals = array(
   16:     MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
   17:     MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1, 
   18:     MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
   19: );
   20: 
   21: 
   22: foreach ($longVals as $longVal) {
   23:    echo "--- testing: $longVal ---\n";
   24:    $longVal++;
   25:    var_dump($longVal);
   26: }
   27:    
   28: ?>
   29: ===DONE===
   30: --EXPECT--
   31: --- testing: 9223372036854775807 ---
   32: float(9.2233720368548E+18)
   33: --- testing: -9223372036854775808 ---
   34: int(-9223372036854775807)
   35: --- testing: 2147483647 ---
   36: int(2147483648)
   37: --- testing: -2147483648 ---
   38: int(-2147483647)
   39: --- testing: 9223372034707292160 ---
   40: int(9223372034707292161)
   41: --- testing: -9223372034707292160 ---
   42: int(-9223372034707292159)
   43: --- testing: 2147483648 ---
   44: int(2147483649)
   45: --- testing: -2147483649 ---
   46: int(-2147483648)
   47: --- testing: 4294967294 ---
   48: int(4294967295)
   49: --- testing: 4294967295 ---
   50: int(4294967296)
   51: --- testing: 4294967293 ---
   52: int(4294967294)
   53: --- testing: 9223372036854775806 ---
   54: int(9223372036854775807)
   55: --- testing: 9.2233720368548E+18 ---
   56: float(9.2233720368548E+18)
   57: --- testing: -9223372036854775807 ---
   58: int(-9223372036854775806)
   59: --- testing: -9.2233720368548E+18 ---
   60: float(-9.2233720368548E+18)
   61: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>