1
0
mirror of https://github.com/danog/amp.git synced 2024-11-30 04:29:08 +01:00

Add 1ms grace period for timing tests

This commit is contained in:
Niklas Keller 2017-03-14 22:18:47 +01:00
parent d8f3810310
commit 179eb3d6f8
2 changed files with 4 additions and 4 deletions

View File

@ -21,7 +21,7 @@ class PauseTest extends \PHPUnit\Framework\TestCase {
$promise->when($callback);
});
$this->assertGreaterThanOrEqual($time, (microtime(true) - $start) * 1000);
$this->assertGreaterThanOrEqual($time - 1 /* 1ms grace period */, (microtime(true) - $start) * 1000);
$this->assertSame($value, $result);
}
@ -42,7 +42,7 @@ class PauseTest extends \PHPUnit\Framework\TestCase {
$promise->when($callback);
});
$this->assertLessThanOrEqual($time, (microtime(true) - $start) * 1000);
$this->assertLessThanOrEqual($time - 1 /* 1ms grace period */, (microtime(true) - $start) * 1000);
$this->assertFalse($invoked);
}

View File

@ -113,7 +113,7 @@ class ProducerTest extends TestCase {
});
});
$this->assertGreaterThan(self::TIMEOUT * $emits, $time * 1000);
$this->assertGreaterThan(self::TIMEOUT * $emits - 1 /* 1ms grace period */, $time * 1000);
}
/**
@ -137,7 +137,7 @@ class ProducerTest extends TestCase {
});
});
$this->assertGreaterThan(self::TIMEOUT * $emits, $time * 1000);
$this->assertGreaterThan(self::TIMEOUT * $emits - 1 /* 1ms grace period */, $time * 1000);
}
/**