You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
796 B
29 lines
796 B
3 months ago
|
<?php
|
||
|
namespace STS\Backoff\Strategies;
|
||
|
|
||
|
use PHPUnit\Framework\TestCase;
|
||
|
|
||
|
class ExponentialStrategyTest extends TestCase
|
||
|
{
|
||
|
public function testDefaults()
|
||
|
{
|
||
|
$s = new ExponentialStrategy();
|
||
|
|
||
|
$this->assertEquals(100, $s->getBase());
|
||
|
}
|
||
|
|
||
|
public function testWaitTimes()
|
||
|
{
|
||
|
$s = new ExponentialStrategy(200);
|
||
|
|
||
|
$this->assertEquals(200, $s->getWaitTime(1));
|
||
|
$this->assertEquals(800, $s->getWaitTime(2));
|
||
|
$this->assertEquals(1600, $s->getWaitTime(3));
|
||
|
$this->assertEquals(3200, $s->getWaitTime(4));
|
||
|
$this->assertEquals(6400, $s->getWaitTime(5));
|
||
|
$this->assertEquals(12800, $s->getWaitTime(6));
|
||
|
$this->assertEquals(25600, $s->getWaitTime(7));
|
||
|
$this->assertEquals(51200, $s->getWaitTime(8));
|
||
|
}
|
||
|
}
|