Exemplo n.º 1
0
 public function testsRunVeryFast()
 {
     $start = microtime(true);
     $fib = Fibonacci::get(300);
     $end = microtime(true) - $start;
     $expectedApprox = 2.2223224462942E+62;
     G\Assertion::assertTrue(abs(($fib - $expectedApprox) / $expectedApprox) < 0.001, 'The Fibonacci should still produce a close to correct answer');
     G\Assertion::assertLess(0.01, $end, 'The Fibonacci should not take too long');
 }
<?php

require_once 'autoload.php';
include 'static/top.php';
use GedasTheEvil\Profiler\Profiler;
use GedasTheEvil\Product\FibonacciNonOptimized;
use GedasTheEvil\Product\Fibonacci;
$test = basename(__FILE__);
Profiler::start($test);
FibonacciNonOptimized::get(25);
Fibonacci::get(25);
Profiler::end($test);
echo Profiler::getHtmlReportContent();
include 'static/bottom.php';
<?php

require_once 'autoload.php';
include 'static/top.php';
use GedasTheEvil\Profiler\Profiler;
use GedasTheEvil\Product\Fibonacci;
$test = basename(__FILE__);
Profiler::start($test);
Fibonacci::get(3000);
Profiler::end($test);
echo Profiler::getHtmlReportContent();
include 'static/bottom.php';