public function cmp_ok($exp1, $op, $exp2, $message = '') { switch ($op) { case '==': case '===': assertEquals($exp2, $exp1); break; case '!=': case '!==': assertNotEquals($exp2, $exp1); break; case '>': assertGreaterThan($exp2, $exp1); break; case '<': assertLessThan($exp2, $exp1); break; case '>=': assertGreaterThanOrEqual($exp2, $exp1); break; case '<=': assertLessThanOrEqual($exp2, $exp1); break; } }
public function testBenchmark() { Logger::source('testing'); Logger::sourcetype('testing-laravel-benchmark-posting'); Logger::host('testing'); gc_collect_memory_profiler(function ($usage, $count) { Logger::mark('testBenchmark ' . $count); assertLessThanOrEqual($usage['peak_usage']['usage'], 0); assertLessThanOrEqual($usage['script_memory_leak']['usage'], 0); }, function ($usage, $done) { assertLessThanOrEqual($usage['peak_usage']['usage'], 0); assertLessThanOrEqual($usage['script_memory_leak']['usage'], 0); }, M1k); gc_collect_memory_profiler(function ($usage, $count) { Logger::benchmark(); assertLessThanOrEqual($usage['peak_usage']['usage'], 0); assertLessThanOrEqual($usage['script_memory_leak']['usage'], 0); }, function ($usage, $done) { assertLessThanOrEqual($usage['peak_usage']['usage'], 0); assertLessThanOrEqual($usage['script_memory_leak']['usage'], 0); }, 2); }
/** * @Then Assert the value :arg1 is less than :arg2 or equal * @param $expected * @param $actual */ public function assertLessThanOrEqual($actual, $expected) { assertLessThanOrEqual($expected, $actual, sprintf("Assert the value [%s] is less than [%s] or equal", $actual, $expected)); }