Annotation of embedaddon/php/tests/lang/operators/operator_lt_variation_64bit.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test < operator : max int 64bit range
                      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: $validLessThan = array (
                     16: 2147483646, array(MAX_32Bit, "2147483647", "2147483647.001", 2.147483647e9, 2147483647.9),
                     17: MIN_32Bit, array(MIN_32Bit + 1, "-2147483647", "-2147483646.001", -2.1474836461e9, -2147483646.9),
                     18: );
                     19: 
                     20: $invalidLessThan = array (
                     21: MAX_32Bit, array("2147483646", 2.1474836460001e9, MAX_32Bit - 1),
                     22: MIN_32Bit, array(MIN_32Bit - 1, "-2147483649", -2.1474836480001e9)
                     23: );
                     24: 
                     25: $failed = false;
                     26: // test for equality
                     27: for ($i = 0; $i < count($validLessThan); $i +=2) {
                     28:    $typeToTestVal = $validLessThan[$i];
                     29:    $compares = $validLessThan[$i + 1];
                     30:    foreach($compares as $compareVal) {
                     31:       if ($typeToTestVal < $compareVal) {
                     32:          // do nothing
                     33:       }
                     34:       else {
                     35:          echo "FAILED: '$typeToTestVal' >= '$compareVal'\n";
                     36:          $failed = true;
                     37:       }
                     38:    }
                     39: }
                     40: // test for invalid values
                     41: for ($i = 0; $i < count($invalidLessThan); $i +=2) {
                     42:    $typeToTestVal = $invalidLessThan[$i];
                     43:    $compares = $invalidLessThan[$i + 1];
                     44:    foreach($compares as $compareVal) {
                     45:       if ($typeToTestVal < $compareVal) {
                     46:          echo "FAILED: '$typeToTestVal' < '$compareVal'\n";
                     47:          $failed = true;
                     48:       }
                     49:    }
                     50: }
                     51: 
                     52: if ($failed == false) {
                     53:    echo "Test Passed\n";
                     54: }
                     55:    
                     56: ?>
                     57: ===DONE===
                     58: --EXPECT--
                     59: Test Passed
                     60: ===DONE===

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