function test_global_scalar_assign($base)
{
    $t = $base;
    test_start(__FUNCTION__);
    global $a, $b, $c, $d, $e, $f, $g, $h;
    global $i, $j, $k, $l, $m, $n, $o, $p;
    do {
        $a = 1;
        $b = $a;
        $c = $a + $b;
        $d = $c - $a;
        $e = $a + $c - $d - $b;
        $f = $a | $c;
        $g = $b & $d;
        $h = $a ^ $b ^ $c ^ $d ^ $e ^ $f ^ $g;
        $i = $a;
        $j = $b;
        $k = $c;
        $l = $d;
        $m = $e;
        $n = $f;
        $o = $g;
        $p = $h;
    } while (--$t !== 0);
    return test_end(__FUNCTION__);
}
function test_local_float_assign($base)
{
    $t = $base;
    test_start(__FUNCTION__);
    do {
        $a = 6.42;
        $b = 9.42;
        $c = 42.42;
        $d = 69.42;
        $e = 4242.42;
        $f = 17.42;
        $g = 3200000.42;
        $h = -3200000.42;
        $i = $a;
        $j = $b;
        $k = $c;
        $l = $d;
        $m = $e;
        $n = $f;
        $o = $g;
        $p = $h;
    } while (--$t !== 0);
    if (!is_float($a) || $g + $h !== 0.0) {
        test_regression(__FUNCTION__);
    }
    return test_end(__FUNCTION__);
}
function test_local_scalar_assign($base)
{
    $t = $base;
    test_start(__FUNCTION__);
    do {
        $a = 1;
        $b = $a;
        $c = $a + $b;
        $d = $c - $a;
        $e = $a + $c - $d - $b;
        $f = $a | $c;
        $g = $b & $d;
        $h = $a ^ $b ^ $c ^ $d ^ $e ^ $f ^ $g;
        $i = $a;
        $j = $b;
        $k = $c;
        $l = $d;
        $m = $e;
        $n = $f;
        $o = $g;
        $p = $h;
    } while (--$t !== 0);
    if (md5($a . $b . $c . $d . $e . $f . $g . $h . $i . $j . $k . $l . $m . $n . $o . $p) !== 'efe1603e8bbb8403b6bfe7a43a39ade1') {
        test_regression(__FUNCTION__);
    }
    return test_end(__FUNCTION__);
}
function test_local_integer_assign($base)
{
    $t = $base;
    test_start(__FUNCTION__);
    do {
        $a = 6;
        $b = 9;
        $c = 42;
        $d = 69;
        $e = 4242;
        $f = 17;
        $g = 3200000;
        $h = -3200000;
        $i = $a;
        $j = $b;
        $k = $c;
        $l = $d;
        $m = $e;
        $n = $f;
        $o = $g;
        $p = $h;
    } while (--$t !== 0);
    if ($g + $h !== 0) {
        test_regression(__FUNCTION__);
    }
    return test_end(__FUNCTION__);
}
function test_global_string_assign($base)
{
    $t = $base;
    test_start(__FUNCTION__);
    global $a, $b, $c, $d, $e, $f, $g, $h;
    global $i, $j, $k, $l, $m, $n, $o, $p;
    do {
        $a = 'abcdefghijklmnop';
        $b = $a;
        $c = $a . $b;
        $d = $c . $a;
        $e = $a . $c . $d . $b;
        $f = $a . $c;
        $g = $b . $d;
        $h = $a . $b . $c . $d . $e . $f . $g;
        $i = $a;
        $j = $b;
        $k = $c;
        $l = $d;
        $m = $e;
        $n = $f;
        $o = $g;
        $p = $h;
    } while (--$t !== 0);
    return test_end(__FUNCTION__);
}
function test_local_string_assign($base)
{
    $t = $base;
    test_start(__FUNCTION__);
    do {
        $a = 'abcdefghijklmnop';
        $b = $a;
        $c = $a . $b;
        $d = $c . $a;
        $e = $a . $c . $d . $b;
        $f = $a . $c;
        $g = $b . $d;
        $h = $a . $b . $c . $d . $e . $f . $g;
        $i = $a;
        $j = $b;
        $k = $c;
        $l = $d;
        $m = $e;
        $n = $f;
        $o = $g;
        $p = $h;
    } while (--$t !== 0);
    if (md5($a . $b . $c . $d . $e . $f . $g . $h . $i . $j . $k . $l . $m . $n . $o . $p) !== '12d5479a566db15ec0028b9cf242d150') {
        test_regression(__FUNCTION__);
    }
    return test_end(__FUNCTION__);
}
Example #7
0
function test_empty_loop($base)
{
    $t = $base * 30;
    test_start(__FUNCTION__);
    do {
    } while (--$t !== 0);
    return test_end(__FUNCTION__);
}
Example #8
0
function test_mt_rand($base)
{
    $t = $base;
    test_start(__FUNCTION__);
    do {
        if (mt_rand(1, 255) <= 0) {
            test_regression(__FUNCTION__);
        }
    } while (--$t !== 0);
    return test_end(__FUNCTION__);
}
Example #9
0
function test_md5($base)
{
    $t = $base;
    test_start(__FUNCTION__);
    do {
        if (md5($t) == '') {
            test_regression(__FUNCTION__);
        }
    } while (--$t !== 0);
    return test_end(__FUNCTION__);
}
Example #10
0
function test_compare_invert($base)
{
    $a = array(42);
    $t = $base;
    test_start(__FUNCTION__);
    do {
        if (!$a) {
            test_regression(__FUNCTION__);
        }
    } while (--$t !== 0);
    return test_end(__FUNCTION__);
}
Example #11
0
function test_compare_false($base)
{
    $a = array(42);
    $t = $base;
    test_start(__FUNCTION__);
    do {
        if ($a === FALSE) {
            test_regression(__FUNCTION__);
        }
    } while (--$t !== 0);
    return test_end(__FUNCTION__);
}
Example #12
0
function test_time($base)
{
    $t = $base;
    test_start(__FUNCTION__);
    do {
        $a = time();
        if (time() < $a) {
            test_regression(__FUNCTION__);
        }
    } while (--$t !== 0);
    return test_end(__FUNCTION__);
}
Example #13
0
function test_empty($base)
{
    $a = str_repeat('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 1000);
    $t = $base;
    test_start(__FUNCTION__);
    do {
        if (empty($a)) {
            test_regression(__FUNCTION__);
        }
    } while (--$t !== 0);
    return test_end(__FUNCTION__);
}
function test_local_object_assign($base)
{
    $t = $base;
    test_start(__FUNCTION__);
    do {
        $a = new TestLocalObjectAssign();
    } while (--$t !== 0);
    if (!is_object($a) || $a->ok() !== TRUE) {
        test_regression(__FUNCTION__);
    }
    return test_end(__FUNCTION__);
}
Example #15
0
function test_while($base)
{
    $t = (int) round($base / 10);
    test_start(__FUNCTION__);
    do {
        $d = 1000;
        while ($d !== 0) {
            $d--;
        }
    } while (--$t !== 0);
    return test_end(__FUNCTION__);
}
Example #16
0
function test_microtime($base)
{
    $t = $base;
    test_start(__FUNCTION__);
    do {
        $a = microtime();
        $b = microtime();
        if ($a[0] < $b[0]) {
            test_regression(__FUNCTION__);
        }
    } while (--$t !== 0);
    return test_end(__FUNCTION__);
}
Example #17
0
function test_line($base)
{
    $t = $base;
    test_start(__FUNCTION__);
    $a = 0;
    do {
        $a += __LINE__;
        $a -= __LINE__;
        $a++;
    } while (--$t !== 0);
    if ($a !== 0) {
        test_regression(__FUNCTION__);
    }
    return test_end(__FUNCTION__);
}
Example #18
0
function test_preg_match($base)
{
    $strings = array('Wesh wesh yo', 'wesh this is a benchmark', 'the PHP benchmarks', 'Yeah weshhh');
    $t = (int) round($base / 5);
    test_start(__FUNCTION__);
    $matches = array();
    do {
        foreach ($strings as $string) {
            if (preg_match('/(y(eah|o)|th(e|is)|wesh(hh)?|benchmarks?|a|php|is)/i', $string, $matches) <= 0 || empty($matches[1])) {
                test_regression(__FUNCTION__);
            }
        }
    } while (--$t !== 0);
    return test_end(__FUNCTION__);
}
Example #19
0
function test_get_class($base)
{
    $a = new TestGetClass();
    $t = $base;
    test_start(__FUNCTION__);
    do {
        if (strtolower(get_class($a)) !== 'testgetclass') {
            test_regression(__FUNCTION__);
        }
    } while (--$t !== 0);
    if (!is_object($a) || $a->ok() !== TRUE) {
        test_regression(__FUNCTION__);
    }
    return test_end(__FUNCTION__);
}
Example #20
0
function test_ereg($base)
{
    $strings = array('*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**');
    $t = (int) round($base / 5);
    test_start(__FUNCTION__);
    $matches = array();
    do {
        foreach ($strings as $string) {
            if (eregi('^[a-z0-9]+([_\\.-][a-z0-9]+)*' . '@([a-z0-9]+([\\.-][a-z0-9]{1,})+)*$', $string, $matches) <= 0 || empty($matches[2])) {
                test_regression(__FUNCTION__);
            }
        }
    } while (--$t !== 0);
    return test_end(__FUNCTION__);
}
Example #21
0
function test_compare_strict($base)
{
    $a = 42;
    $b = '69';
    $t = $base;
    test_start(__FUNCTION__);
    do {
        $c = $a === $b;
        $d = $a !== $b;
    } while (--$t !== 0);
    if ("{$c} {$d}" !== ' 1') {
        test_regression(__FUNCTION__);
    }
    return test_end(__FUNCTION__);
}
Example #22
0
function test_constants($base)
{
    $t = $base;
    test_start(__FUNCTION__);
    define('TEST_CONSTANTS_XXX', 'xxx');
    define('TEST_CONSTANTS_NAME', 'TEST_CONSTANTS_XXX');
    do {
        $a = TEST_CONSTANTS_XXX;
        $b = defined(TEST_CONSTANTS_NAME);
        $c = constant(TEST_CONSTANTS_NAME);
    } while (--$t !== 0);
    if ("{$a}{$b}{$c}" !== 'xxx1xxx') {
        test_regression(__FUNCTION__);
    }
    return test_end(__FUNCTION__);
}
function test_ordered_functions($base)
{
    $t = $base;
    test_start(__FUNCTION__);
    do {
        $a = tof_1(42, -1);
        $b = tof_1($a, 42.67);
        $c = tof_1($b, 'xxx');
        $d = tof_1($c, NULL);
        $e = tof_1($a, tof_1($b, tof_1($c, tof_1($d, $a))));
    } while (--$t !== 0);
    if ("{$a}{$b}{$c}{$d}{$e}" !== '4183.6783.6783.67333.01') {
        test_regression(__FUNCTION__);
    }
    return test_end(__FUNCTION__);
}
Example #24
0
function test_chr_fixed($base)
{
    $t = (int) round($base / 10);
    test_start(__FUNCTION__);
    do {
        $b = '';
        $c = 256;
        do {
            $c--;
            $b .= chr(128);
        } while ($c !== 0);
    } while (--$t !== 0);
    if (md5($b) !== 'b031e074f57a105f0d91cca34e902c82') {
        test_regression(__FUNCTION__);
    }
    return test_end(__FUNCTION__);
}
Example #25
0
function test_references($base)
{
    $t = $base;
    test_start(__FUNCTION__);
    do {
        $a = 42;
        $b =& $a;
        $b = 69;
        $c =& $b;
        $a = 17;
        $c = 21;
    } while (--$t !== 0);
    if ("{$a}{$b}{$c}" !== '212121') {
        test_regression(__FUNCTION__);
    }
    return test_end(__FUNCTION__);
}
function test_local_hash_assign($base)
{
    $a = array();
    $t = $base;
    test_start(__FUNCTION__);
    do {
        $a['xxx'] = 'xxx';
        $a['1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25'] = $a['xxx'];
        $a['a, b'] = $a['1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25'];
        $a['yyy'] = $a['a, b'];
        $a[4242] = $a['yyy'];
    } while (--$t !== 0);
    if (count($a) !== 5) {
        test_regression(__FUNCTION__);
    }
    return test_end(__FUNCTION__);
}
Example #27
0
function test_chr_var($base)
{
    $t = (int) round($base / 10);
    test_start(__FUNCTION__);
    do {
        $b = '';
        $c = 256;
        do {
            $c--;
            $b .= chr($c);
        } while ($c !== 0);
    } while (--$t !== 0);
    if (md5($b) !== 'ec6df70f2569891eae50321a9179eb82') {
        test_regression(__FUNCTION__);
    }
    return test_end(__FUNCTION__);
}
function test_variable_variables($base)
{
    $t = $base;
    test_start(__FUNCTION__);
    do {
        $a = 'b';
        ${$a} = 'c';
        ${$b} = 'd';
        ${$c} = 'e';
        ${$d} = ${$c};
        ${${$d}} = "\${$b}";
    } while (--$t !== 0);
    if ("{$a}{$b}{$c}{$d}{$e}" !== 'bcde$c') {
        test_regression(__FUNCTION__);
    }
    return test_end(__FUNCTION__);
}
Example #29
0
function test_increment($base)
{
    $t = $base;
    test_start(__FUNCTION__);
    do {
        $b = $a = 5;
        $c = $a++;
        $e = $d = ++$b;
        $f = ceil($d++);
        $g = floor(++$e);
        $h = $g += 2;
    } while (--$t !== 0);
    if ("{$a}{$b}{$c}{$d}{$e}{$f}{$g}{$h}" !== '66577699') {
        test_regression(__FUNCTION__);
    }
    return test_end(__FUNCTION__);
}
Example #30
0
function test_string_append($base)
{
    $t = $base;
    test_start(__FUNCTION__);
    do {
        $a = 'abc';
        $b = 'def';
        $a .= $b;
        $b .= $a . $b . $a . $b;
        $a = "{$a} {$b} {$b} {$a}";
        $a .= 'x' . 'y' . 'z';
        $b .= "{$a}{$b}" . 'hij';
    } while (--$t !== 0);
    if (md5("{$a}{$b}") !== 'b7988e4fb634f7e856fb19d7005d9dfa') {
        test_regression(__FUNCTION__);
    }
    return test_end(__FUNCTION__);
}