mirror of
https://github.com/furyfire/trueskill.git
synced 2025-01-15 17:37:39 +00:00
Unittesting
This commit is contained in:
@ -32,13 +32,13 @@
|
|||||||
"phplint",
|
"phplint",
|
||||||
"phpcs"
|
"phpcs"
|
||||||
],
|
],
|
||||||
"static": [
|
"analyze": [
|
||||||
"@analyze-phpstan",
|
"@analyze-phpstan",
|
||||||
"@analyze-psalm",
|
"@analyze-psalm",
|
||||||
"@analyze-rector"
|
"@analyze-rector"
|
||||||
],
|
],
|
||||||
"analyze-phpstan":"vendor/bin/phpstan analyze --error-format=raw",
|
"analyze-phpstan":"vendor/bin/phpstan analyze --error-format=raw",
|
||||||
"analyze-psalm": "vendor/bin/psalm --no-cache",
|
"analyze-psalm": "vendor/bin/psalm --no-cache --show-info=true",
|
||||||
"analyze-rector": "vendor/bin/rector --dry-run",
|
"analyze-rector": "vendor/bin/rector --dry-run",
|
||||||
"html": [
|
"html": [
|
||||||
"pandoc -s README.md -o output/README.html",
|
"pandoc -s README.md -o output/README.html",
|
||||||
@ -49,7 +49,7 @@
|
|||||||
"@document",
|
"@document",
|
||||||
"@benchmark",
|
"@benchmark",
|
||||||
"@lint",
|
"@lint",
|
||||||
"@static",
|
"@analyze",
|
||||||
"@html"
|
"@html"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ use PHPUnit\Framework\TestCase;
|
|||||||
|
|
||||||
class ScheduleStepTest extends TestCase
|
class ScheduleStepTest extends TestCase
|
||||||
{
|
{
|
||||||
public function test(): void
|
public function testtoStringInterface(): void
|
||||||
{
|
{
|
||||||
$stub = $this->createStub(Factor::class);
|
$stub = $this->createStub(Factor::class);
|
||||||
$ss = new ScheduleStep('dummy', $stub, 0);
|
$ss = new ScheduleStep('dummy', $stub, 0);
|
||||||
|
@ -10,7 +10,7 @@ use PHPUnit\Framework\TestCase;
|
|||||||
|
|
||||||
class VariableTest extends TestCase
|
class VariableTest extends TestCase
|
||||||
{
|
{
|
||||||
public function test(): void
|
public function testGetterSetter(): void
|
||||||
{
|
{
|
||||||
$gd_prior = new GaussianDistribution();
|
$gd_prior = new GaussianDistribution();
|
||||||
$var = new Variable('dummy', $gd_prior);
|
$var = new Variable('dummy', $gd_prior);
|
||||||
|
@ -9,10 +9,11 @@ use PHPUnit\Framework\TestCase;
|
|||||||
|
|
||||||
class PlayerTest extends TestCase
|
class PlayerTest extends TestCase
|
||||||
{
|
{
|
||||||
public function test(): void
|
public function testPlayerObjectGetterSetter(): void
|
||||||
{
|
{
|
||||||
$p = new Player('dummy', 0.1, 0.2);
|
$p = new Player('dummy', 0.1, 0.2);
|
||||||
$this->assertEquals('dummy', (string)$p);
|
$this->assertEquals('dummy', (string)$p);
|
||||||
|
$this->assertEquals('dummy', $p->getId());
|
||||||
$this->assertEquals(0.1, $p->getPartialPlayPercentage());
|
$this->assertEquals(0.1, $p->getPartialPlayPercentage());
|
||||||
$this->assertEquals(0.2, $p->getPartialUpdatePercentage());
|
$this->assertEquals(0.2, $p->getPartialUpdatePercentage());
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@ class TwoPlayerTrueSkillCalculatorTest extends TestCase
|
|||||||
{
|
{
|
||||||
$calculator = new TwoPlayerTrueSkillCalculator();
|
$calculator = new TwoPlayerTrueSkillCalculator();
|
||||||
|
|
||||||
// We only support two players
|
|
||||||
TrueSkillCalculatorTests::testAllTwoPlayerScenarios($this, $calculator);
|
TrueSkillCalculatorTests::testAllTwoPlayerScenarios($this, $calculator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ use PHPUnit\Framework\TestCase;
|
|||||||
use PHPUnit\Framework\Attributes\CoversClass;
|
use PHPUnit\Framework\Attributes\CoversClass;
|
||||||
use PHPUnit\Framework\Attributes\CoversNothing;
|
use PHPUnit\Framework\Attributes\CoversNothing;
|
||||||
|
|
||||||
//#[CoversClass(TwoTeamTrueSkillCalculator::class)]
|
#[CoversClass(TwoTeamTrueSkillCalculator::class)]
|
||||||
class TwoTeamTrueSkillCalculatorTest extends TestCase
|
class TwoTeamTrueSkillCalculatorTest extends TestCase
|
||||||
{
|
{
|
||||||
#[CoversNothing]
|
#[CoversNothing]
|
||||||
@ -17,7 +17,6 @@ class TwoTeamTrueSkillCalculatorTest extends TestCase
|
|||||||
{
|
{
|
||||||
$calculator = new TwoTeamTrueSkillCalculator();
|
$calculator = new TwoTeamTrueSkillCalculator();
|
||||||
|
|
||||||
// We only support two players
|
|
||||||
TrueSkillCalculatorTests::testAllTwoPlayerScenarios($this, $calculator);
|
TrueSkillCalculatorTests::testAllTwoPlayerScenarios($this, $calculator);
|
||||||
TrueSkillCalculatorTests::testAllTwoTeamScenarios($this, $calculator);
|
TrueSkillCalculatorTests::testAllTwoTeamScenarios($this, $calculator);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user