mirror of
https://github.com/furyfire/trueskill.git
synced 2025-01-15 17:37:39 +00:00
Additional test
This commit is contained in:
22
composer.lock
generated
22
composer.lock
generated
@ -1197,16 +1197,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "1.10.55",
|
||||
"version": "1.10.56",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan.git",
|
||||
"reference": "9a88f9d18ddf4cf54c922fbeac16c4cb164c5949"
|
||||
"reference": "27816a01aea996191ee14d010f325434c0ee76fa"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/9a88f9d18ddf4cf54c922fbeac16c4cb164c5949",
|
||||
"reference": "9a88f9d18ddf4cf54c922fbeac16c4cb164c5949",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/27816a01aea996191ee14d010f325434c0ee76fa",
|
||||
"reference": "27816a01aea996191ee14d010f325434c0ee76fa",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1255,7 +1255,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-01-08T12:32:40+00:00"
|
||||
"time": "2024-01-15T10:43:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
@ -1580,16 +1580,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "10.5.5",
|
||||
"version": "10.5.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "ed21115d505b4b4f7dc7b5651464e19a2c7f7856"
|
||||
"reference": "e5c5b397a95cb0db013270a985726fcae93e61b8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ed21115d505b4b4f7dc7b5651464e19a2c7f7856",
|
||||
"reference": "ed21115d505b4b4f7dc7b5651464e19a2c7f7856",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e5c5b397a95cb0db013270a985726fcae93e61b8",
|
||||
"reference": "e5c5b397a95cb0db013270a985726fcae93e61b8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1661,7 +1661,7 @@
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.5"
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.7"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -1677,7 +1677,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-12-27T15:13:52+00:00"
|
||||
"time": "2024-01-14T16:40:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/container",
|
||||
|
@ -4,6 +4,7 @@ namespace DNW\Skills\Tests;
|
||||
|
||||
use DNW\Skills\Guard;
|
||||
use Exception;
|
||||
|
||||
class GuardTest extends TestCase
|
||||
{
|
||||
public function testArgumentNotNull(): void
|
||||
|
32
tests/RatingTest.php
Normal file
32
tests/RatingTest.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace DNW\Skills\Tests;
|
||||
|
||||
use DNW\Skills\Rating;
|
||||
|
||||
class RatingTest extends TestCase
|
||||
{
|
||||
public function testGetRatingParameters(): void
|
||||
{
|
||||
$rating = new Rating(100, 10, 5);
|
||||
$this->assertEquals(100, $rating->getMean());
|
||||
$this->assertEquals(10, $rating->getStandardDeviation());
|
||||
$this->assertEquals(50, $rating->getConservativeRating());
|
||||
$this->assertEquals("mean=100.0000, standardDeviation=10.0000", (string)$rating);
|
||||
}
|
||||
|
||||
public function testPartialUpdate(): void
|
||||
{
|
||||
$rating = new Rating(100, 10, 5);
|
||||
$rating_prior = new Rating(100, 10, 5);
|
||||
$rating_new = new Rating(200, 10, 5);
|
||||
|
||||
$rating_partial = $rating ->getPartialUpdate($rating_prior, $rating_new, 0.5);
|
||||
|
||||
|
||||
$this->assertEquals(150, $rating_partial->getMean());
|
||||
$this->assertEquals(10, $rating_partial->getStandardDeviation());
|
||||
$this->assertEquals(100, $rating_partial->getConservativeRating());
|
||||
$this->assertEquals("mean=150.0000, standardDeviation=10.0000", (string)$rating_partial);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user