Chris@0: assertGreaterThanOrEqual(4, $value, 'Timer failed to measure at least 4 milliseconds of sleeping while running.'); Chris@0: Chris@0: $this->assertGreaterThanOrEqual($value + 4, $value2, 'Timer failed to measure at least 8 milliseconds of sleeping while running.'); Chris@0: Chris@0: $this->assertGreaterThanOrEqual($value2 + 4, $value3, 'Timer failed to measure at least 12 milliseconds of sleeping while running.'); Chris@0: Chris@0: $this->assertGreaterThanOrEqual($value3 + 4, $value4, 'Timer failed to measure at least 16 milliseconds of sleeping while running.'); Chris@0: Chris@0: // Stop the timer. Chris@0: $value5 = Timer::stop('test'); Chris@0: $this->assertGreaterThanOrEqual($value4, $value5['time'], 'Timer measured after stopping was not greater than last measurement.'); Chris@0: Chris@0: // Read again. Chris@0: $value6 = Timer::read('test'); Chris@0: $this->assertEquals($value5['time'], $value6, 'Timer measured after stopping was not equal to the stopped time.'); Chris@0: Chris@0: // Restart. Chris@0: Timer::start('test'); Chris@0: usleep(5000); Chris@0: $value7 = Timer::read('test'); Chris@0: $this->assertGreaterThanOrEqual($value6 + 4, $value7, 'Timer failed to measure at least 16 milliseconds of sleeping while running.'); Chris@0: Chris@0: // Stop again. Chris@0: $value8 = Timer::stop('test'); Chris@0: $value9 = Timer::read('test'); Chris@0: $this->assertEquals($value8['time'], $value9, 'Timer measured after stopping not equal to stop time.'); Chris@0: } Chris@0: Chris@0: }