mirror of
https://github.com/furyfire/trueskill.git
synced 2025-01-16 01:47:39 +00:00
Cleanup in tests/: adding namespaces, removing php closing tag and general code cleanup
This commit is contained in:
@ -1,9 +1,4 @@
|
|||||||
<?php
|
<?php namespace Moserware\Skills\Tests\Elo;
|
||||||
namespace Moserware\Skills\Elo;
|
|
||||||
|
|
||||||
require_once(dirname(__FILE__) . '/../../Skills/Elo/EloRating.php');
|
|
||||||
require_once(dirname(__FILE__) . '/../../Skills/GameInfo.php');
|
|
||||||
require_once(dirname(__FILE__) . '/../../Skills/PairwiseComparison.php');
|
|
||||||
|
|
||||||
use Moserware\Skills\GameInfo;
|
use Moserware\Skills\GameInfo;
|
||||||
use Moserware\Skills\PairwiseComparison;
|
use Moserware\Skills\PairwiseComparison;
|
||||||
@ -13,34 +8,32 @@ class EloAssert
|
|||||||
const ERROR_TOLERANCE = 0.1;
|
const ERROR_TOLERANCE = 0.1;
|
||||||
|
|
||||||
public static function assertChessRating(
|
public static function assertChessRating(
|
||||||
$testClass,
|
$testClass,
|
||||||
$twoPlayerEloCalculator,
|
$twoPlayerEloCalculator,
|
||||||
$player1BeforeRating,
|
$player1BeforeRating,
|
||||||
$player2BeforeRating,
|
$player2BeforeRating,
|
||||||
$player1Result,
|
$player1Result,
|
||||||
$player1AfterRating,
|
$player1AfterRating,
|
||||||
$player2AfterRating)
|
$player2AfterRating)
|
||||||
{
|
{
|
||||||
$player1 = "Player1";
|
$player1 = "Player1";
|
||||||
$player2 = "Player2";
|
$player2 = "Player2";
|
||||||
|
|
||||||
$teams = array(
|
$teams = array(
|
||||||
array( $player1 => new EloRating($player1BeforeRating) ),
|
array($player1 => new EloRating($player1BeforeRating)),
|
||||||
array( $player2 => new EloRating($player2BeforeRating) )
|
array($player2 => new EloRating($player2BeforeRating))
|
||||||
);
|
);
|
||||||
|
|
||||||
$chessGameInfo = new GameInfo(1200, 0, 200);
|
$chessGameInfo = new GameInfo(1200, 0, 200);
|
||||||
|
|
||||||
$ranks = PairwiseComparison::getRankFromComparison($player1Result);
|
$ranks = PairwiseComparison::getRankFromComparison($player1Result);
|
||||||
|
|
||||||
$result = $twoPlayerEloCalculator->calculateNewRatings(
|
$result = $twoPlayerEloCalculator->calculateNewRatings(
|
||||||
$chessGameInfo,
|
$chessGameInfo,
|
||||||
$teams,
|
$teams,
|
||||||
$ranks);
|
$ranks);
|
||||||
|
|
||||||
$testClass->assertEquals($player1AfterRating, $result[$player1]->getMean(), '', self::ERROR_TOLERANCE);
|
$testClass->assertEquals($player1AfterRating, $result[$player1]->getMean(), '', self::ERROR_TOLERANCE);
|
||||||
$testClass->assertEquals($player2AfterRating, $result[$player2]->getMean(), '', self::ERROR_TOLERANCE);
|
$testClass->assertEquals($player2AfterRating, $result[$player2]->getMean(), '', self::ERROR_TOLERANCE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
||||||
|
@ -1,13 +1,8 @@
|
|||||||
<?php
|
<?php namespace Moserware\Skills\Tests\Elo;
|
||||||
namespace Moserware\Skills\Elo;
|
|
||||||
|
|
||||||
require_once(dirname(__FILE__) . '/EloAssert.php');
|
|
||||||
require_once(dirname(__FILE__) . '/../../Skills/PairwiseComparison.php');
|
|
||||||
require_once(dirname(__FILE__) . '/../../Skills/Elo/FideEloCalculator.php');
|
|
||||||
require_once(dirname(__FILE__) . '/../../Skills/Elo/FideKFactor.php');
|
|
||||||
|
|
||||||
|
use Moserware\Skills\Elo\FideEloCalculator;
|
||||||
|
use Moserware\Skills\Elo\ProvisionalFideKFactor;
|
||||||
use Moserware\Skills\PairwiseComparison;
|
use Moserware\Skills\PairwiseComparison;
|
||||||
use \PHPUnit_Framework_TestCase;
|
|
||||||
|
|
||||||
class FideEloCalculatorTest extends PHPUnit_Framework_TestCase
|
class FideEloCalculatorTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
@ -35,5 +30,3 @@ class FideEloCalculatorTest extends PHPUnit_Framework_TestCase
|
|||||||
EloAssert::assertChessRating($this, $calc, 2600, 2500, PairwiseComparison::LOSE, 2593.6, 2506.4);
|
EloAssert::assertChessRating($this, $calc, 2600, 2500, PairwiseComparison::LOSE, 2593.6, 2506.4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
<?php
|
<?php namespace Moserware\Skills\Tests\Numerics;
|
||||||
require_once 'PHPUnit/Framework.php';
|
|
||||||
require_once(dirname(__FILE__) . '/../../Skills/Numerics/BasicMath.php');
|
|
||||||
|
|
||||||
|
|
||||||
class BasicMathTest extends PHPUnit_Framework_TestCase
|
class BasicMathTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testSquare()
|
public function testSquare()
|
||||||
{
|
{
|
||||||
$this->assertEquals( 1, Moserware\Numerics\square(1) );
|
$this->assertEquals(1, Moserware\Numerics\square(1));
|
||||||
$this->assertEquals( 1.44, Moserware\Numerics\square(1.2) );
|
$this->assertEquals(1.44, Moserware\Numerics\square(1.2));
|
||||||
$this->assertEquals( 4, Moserware\Numerics\square(2) );
|
$this->assertEquals(4, Moserware\Numerics\square(2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
@ -1,11 +1,4 @@
|
|||||||
<?php
|
<?php namespace Moserware\Skills\Tests\Numerics;
|
||||||
namespace Moserware\Numerics;
|
|
||||||
|
|
||||||
require_once 'PHPUnit/Framework.php';
|
|
||||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
|
||||||
|
|
||||||
require_once(dirname(__FILE__) . '/../../Skills/Numerics/GaussianDistribution.php');
|
|
||||||
|
|
||||||
|
|
||||||
use \PHPUnit_Framework_TestCase;
|
use \PHPUnit_Framework_TestCase;
|
||||||
|
|
||||||
@ -101,6 +94,3 @@ class GaussianDistributionTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals(0.4330127018922193, $absDiff2, '', GaussianDistributionTest::ERROR_TOLERANCE);
|
$this->assertEquals(0.4330127018922193, $absDiff2, '', GaussianDistributionTest::ERROR_TOLERANCE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
<?php
|
<?php namespace Moserware\Skills\Tests;
|
||||||
require_once 'PHPUnit/Framework.php';
|
|
||||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
|
||||||
|
|
||||||
require_once(dirname(__FILE__) . '/../../Skills/Numerics/Matrix.php');
|
|
||||||
|
|
||||||
use \PHPUnit_Framework_TestCase;
|
use \PHPUnit_Framework_TestCase;
|
||||||
use Moserware\Numerics\Matrix;
|
use Moserware\Numerics\Matrix;
|
||||||
@ -14,22 +10,22 @@ class MatrixTest extends PHPUnit_Framework_TestCase
|
|||||||
public function testTwoByTwoDeterminant()
|
public function testTwoByTwoDeterminant()
|
||||||
{
|
{
|
||||||
$a = new SquareMatrix(1, 2,
|
$a = new SquareMatrix(1, 2,
|
||||||
3, 4);
|
3, 4);
|
||||||
|
|
||||||
$this->assertEquals(-2, $a->getDeterminant());
|
$this->assertEquals(-2, $a->getDeterminant());
|
||||||
|
|
||||||
$b = new SquareMatrix(3, 4,
|
$b = new SquareMatrix(3, 4,
|
||||||
5, 6);
|
5, 6);
|
||||||
|
|
||||||
$this->assertEquals(-2, $b->getDeterminant());
|
$this->assertEquals(-2, $b->getDeterminant());
|
||||||
|
|
||||||
$c = new SquareMatrix(1, 1,
|
$c = new SquareMatrix(1, 1,
|
||||||
1, 1);
|
1, 1);
|
||||||
|
|
||||||
$this->assertEquals(0, $c->getDeterminant());
|
$this->assertEquals(0, $c->getDeterminant());
|
||||||
|
|
||||||
$d = new SquareMatrix(12, 15,
|
$d = new SquareMatrix(12, 15,
|
||||||
17, 21);
|
17, 21);
|
||||||
|
|
||||||
$this->assertEquals(12 * 21 - 15 * 17, $d->getDeterminant());
|
$this->assertEquals(12 * 21 - 15 * 17, $d->getDeterminant());
|
||||||
}
|
}
|
||||||
@ -37,13 +33,13 @@ class MatrixTest extends PHPUnit_Framework_TestCase
|
|||||||
public function testThreeByThreeDeterminant()
|
public function testThreeByThreeDeterminant()
|
||||||
{
|
{
|
||||||
$a = new SquareMatrix(1, 2, 3,
|
$a = new SquareMatrix(1, 2, 3,
|
||||||
4, 5, 6,
|
4, 5, 6,
|
||||||
7, 8, 9);
|
7, 8, 9);
|
||||||
$this->assertEquals(0, $a->getDeterminant());
|
$this->assertEquals(0, $a->getDeterminant());
|
||||||
|
|
||||||
$pi = new SquareMatrix(3, 1, 4,
|
$pi = new SquareMatrix(3, 1, 4,
|
||||||
1, 5, 9,
|
1, 5, 9,
|
||||||
2, 6, 5);
|
2, 6, 5);
|
||||||
|
|
||||||
// Verified against http://www.wolframalpha.com/input/?i=determinant+%7B%7B3%2C1%2C4%7D%2C%7B1%2C5%2C9%7D%2C%7B2%2C6%2C5%7D%7D
|
// Verified against http://www.wolframalpha.com/input/?i=determinant+%7B%7B3%2C1%2C4%7D%2C%7B1%2C5%2C9%7D%2C%7B2%2C6%2C5%7D%7D
|
||||||
$this->assertEquals(-90, $pi->getDeterminant());
|
$this->assertEquals(-90, $pi->getDeterminant());
|
||||||
@ -51,17 +47,17 @@ class MatrixTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testFourByFourDeterminant()
|
public function testFourByFourDeterminant()
|
||||||
{
|
{
|
||||||
$a = new SquareMatrix( 1, 2, 3, 4,
|
$a = new SquareMatrix(1, 2, 3, 4,
|
||||||
5, 6, 7, 8,
|
5, 6, 7, 8,
|
||||||
9, 10, 11, 12,
|
9, 10, 11, 12,
|
||||||
13, 14, 15, 16);
|
13, 14, 15, 16);
|
||||||
|
|
||||||
$this->assertEquals(0, $a->getDeterminant());
|
$this->assertEquals(0, $a->getDeterminant());
|
||||||
|
|
||||||
$pi = new SquareMatrix(3, 1, 4, 1,
|
$pi = new SquareMatrix(3, 1, 4, 1,
|
||||||
5, 9, 2, 6,
|
5, 9, 2, 6,
|
||||||
5, 3, 5, 8,
|
5, 3, 5, 8,
|
||||||
9, 7, 9, 3);
|
9, 7, 9, 3);
|
||||||
|
|
||||||
// Verified against http://www.wolframalpha.com/input/?i=determinant+%7B+%7B3%2C1%2C4%2C1%7D%2C+%7B5%2C9%2C2%2C6%7D%2C+%7B5%2C3%2C5%2C8%7D%2C+%7B9%2C7%2C9%2C3%7D%7D
|
// Verified against http://www.wolframalpha.com/input/?i=determinant+%7B+%7B3%2C1%2C4%2C1%7D%2C+%7B5%2C9%2C2%2C6%7D%2C+%7B5%2C3%2C5%2C8%7D%2C+%7B9%2C7%2C9%2C3%7D%7D
|
||||||
$this->assertEquals(98, $pi->getDeterminant());
|
$this->assertEquals(98, $pi->getDeterminant());
|
||||||
@ -69,25 +65,25 @@ class MatrixTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testEightByEightDeterminant()
|
public function testEightByEightDeterminant()
|
||||||
{
|
{
|
||||||
$a = new SquareMatrix( 1, 2, 3, 4, 5, 6, 7, 8,
|
$a = new SquareMatrix(1, 2, 3, 4, 5, 6, 7, 8,
|
||||||
9, 10, 11, 12, 13, 14, 15, 16,
|
9, 10, 11, 12, 13, 14, 15, 16,
|
||||||
17, 18, 19, 20, 21, 22, 23, 24,
|
17, 18, 19, 20, 21, 22, 23, 24,
|
||||||
25, 26, 27, 28, 29, 30, 31, 32,
|
25, 26, 27, 28, 29, 30, 31, 32,
|
||||||
33, 34, 35, 36, 37, 38, 39, 40,
|
33, 34, 35, 36, 37, 38, 39, 40,
|
||||||
41, 42, 32, 44, 45, 46, 47, 48,
|
41, 42, 32, 44, 45, 46, 47, 48,
|
||||||
49, 50, 51, 52, 53, 54, 55, 56,
|
49, 50, 51, 52, 53, 54, 55, 56,
|
||||||
57, 58, 59, 60, 61, 62, 63, 64);
|
57, 58, 59, 60, 61, 62, 63, 64);
|
||||||
|
|
||||||
$this->assertEquals(0, $a->getDeterminant());
|
$this->assertEquals(0, $a->getDeterminant());
|
||||||
|
|
||||||
$pi = new SquareMatrix(3, 1, 4, 1, 5, 9, 2, 6,
|
$pi = new SquareMatrix(3, 1, 4, 1, 5, 9, 2, 6,
|
||||||
5, 3, 5, 8, 9, 7, 9, 3,
|
5, 3, 5, 8, 9, 7, 9, 3,
|
||||||
2, 3, 8, 4, 6, 2, 6, 4,
|
2, 3, 8, 4, 6, 2, 6, 4,
|
||||||
3, 3, 8, 3, 2, 7, 9, 5,
|
3, 3, 8, 3, 2, 7, 9, 5,
|
||||||
0, 2, 8, 8, 4, 1, 9, 7,
|
0, 2, 8, 8, 4, 1, 9, 7,
|
||||||
1, 6, 9, 3, 9, 9, 3, 7,
|
1, 6, 9, 3, 9, 9, 3, 7,
|
||||||
5, 1, 0, 5, 8, 2, 0, 9,
|
5, 1, 0, 5, 8, 2, 0, 9,
|
||||||
7, 4, 9, 4, 4, 5, 9, 2);
|
7, 4, 9, 4, 4, 5, 9, 2);
|
||||||
|
|
||||||
// Verified against http://www.wolframalpha.com/input/?i=det+%7B%7B3%2C1%2C4%2C1%2C5%2C9%2C2%2C6%7D%2C%7B5%2C3%2C5%2C8%2C9%2C7%2C9%2C3%7D%2C%7B2%2C3%2C8%2C4%2C6%2C2%2C6%2C4%7D%2C%7B3%2C3%2C8%2C3%2C2%2C7%2C9%2C5%7D%2C%7B0%2C2%2C8%2C8%2C4%2C1%2C9%2C7%7D%2C%7B1%2C6%2C9%2C3%2C9%2C9%2C3%2C7%7D%2C%7B5%2C1%2C0%2C5%2C8%2C2%2C0%2C9%7D%2C%7B7%2C4%2C9%2C4%2C4%2C5%2C9%2C2%7D%7D
|
// Verified against http://www.wolframalpha.com/input/?i=det+%7B%7B3%2C1%2C4%2C1%2C5%2C9%2C2%2C6%7D%2C%7B5%2C3%2C5%2C8%2C9%2C7%2C9%2C3%7D%2C%7B2%2C3%2C8%2C4%2C6%2C2%2C6%2C4%7D%2C%7B3%2C3%2C8%2C3%2C2%2C7%2C9%2C5%7D%2C%7B0%2C2%2C8%2C8%2C4%2C1%2C9%2C7%7D%2C%7B1%2C6%2C9%2C3%2C9%2C9%2C3%2C7%7D%2C%7B5%2C1%2C0%2C5%2C8%2C2%2C0%2C9%7D%2C%7B7%2C4%2C9%2C4%2C4%2C5%2C9%2C2%7D%7D
|
||||||
$this->assertEquals(1378143, $pi->getDeterminant());
|
$this->assertEquals(1378143, $pi->getDeterminant());
|
||||||
@ -96,37 +92,37 @@ class MatrixTest extends PHPUnit_Framework_TestCase
|
|||||||
public function testEquals()
|
public function testEquals()
|
||||||
{
|
{
|
||||||
$a = new SquareMatrix(1, 2,
|
$a = new SquareMatrix(1, 2,
|
||||||
3, 4);
|
3, 4);
|
||||||
|
|
||||||
$b = new SquareMatrix(1, 2,
|
$b = new SquareMatrix(1, 2,
|
||||||
3, 4);
|
3, 4);
|
||||||
|
|
||||||
$this->assertTrue($a->equals($b));
|
$this->assertTrue($a->equals($b));
|
||||||
|
|
||||||
$c = Matrix::fromRowsColumns(2, 3,
|
$c = Matrix::fromRowsColumns(2, 3,
|
||||||
1, 2, 3,
|
1, 2, 3,
|
||||||
4, 5, 6);
|
4, 5, 6);
|
||||||
|
|
||||||
$d = Matrix::fromRowsColumns(2, 3,
|
$d = Matrix::fromRowsColumns(2, 3,
|
||||||
1, 2, 3,
|
1, 2, 3,
|
||||||
4, 5, 6);
|
4, 5, 6);
|
||||||
|
|
||||||
$this->assertTrue($c->equals($d));
|
$this->assertTrue($c->equals($d));
|
||||||
|
|
||||||
$e = Matrix::fromRowsColumns(3, 2,
|
$e = Matrix::fromRowsColumns(3, 2,
|
||||||
1, 4,
|
1, 4,
|
||||||
2, 5,
|
2, 5,
|
||||||
3, 6);
|
3, 6);
|
||||||
|
|
||||||
$f = $e->getTranspose();
|
$f = $e->getTranspose();
|
||||||
$this->assertTrue($d->equals($f));
|
$this->assertTrue($d->equals($f));
|
||||||
|
|
||||||
// Test rounding (thanks to nsp on GitHub for finding this case)
|
// Test rounding (thanks to nsp on GitHub for finding this case)
|
||||||
$g = new SquareMatrix(1, 2.00000000000001,
|
$g = new SquareMatrix(1, 2.00000000000001,
|
||||||
3, 4);
|
3, 4);
|
||||||
|
|
||||||
$h = new SquareMatrix(1, 2,
|
$h = new SquareMatrix(1, 2,
|
||||||
3, 4);
|
3, 4);
|
||||||
|
|
||||||
$this->assertTrue($g->equals($h));
|
$this->assertTrue($g->equals($h));
|
||||||
}
|
}
|
||||||
@ -135,21 +131,21 @@ class MatrixTest extends PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
// From Wikipedia: http://en.wikipedia.org/wiki/Adjugate_matrix
|
// From Wikipedia: http://en.wikipedia.org/wiki/Adjugate_matrix
|
||||||
$a = new SquareMatrix(1, 2,
|
$a = new SquareMatrix(1, 2,
|
||||||
3, 4);
|
3, 4);
|
||||||
|
|
||||||
$b = new SquareMatrix( 4, -2,
|
$b = new SquareMatrix(4, -2,
|
||||||
-3, 1);
|
-3, 1);
|
||||||
|
|
||||||
$this->assertTrue($b->equals($a->getAdjugate()));
|
$this->assertTrue($b->equals($a->getAdjugate()));
|
||||||
|
|
||||||
|
|
||||||
$c = new SquareMatrix(-3, 2, -5,
|
$c = new SquareMatrix(-3, 2, -5,
|
||||||
-1, 0, -2,
|
-1, 0, -2,
|
||||||
3, -4, 1);
|
3, -4, 1);
|
||||||
|
|
||||||
$d = new SquareMatrix(-8, 18, -4,
|
$d = new SquareMatrix(-8, 18, -4,
|
||||||
-5, 12, -1,
|
-5, 12, -1,
|
||||||
4, -6, 2);
|
4, -6, 2);
|
||||||
|
|
||||||
$this->assertTrue($d->equals($c->getAdjugate()));
|
$this->assertTrue($d->equals($c->getAdjugate()));
|
||||||
}
|
}
|
||||||
@ -158,10 +154,10 @@ class MatrixTest extends PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
// see http://www.mathwords.com/i/inverse_of_a_matrix.htm
|
// see http://www.mathwords.com/i/inverse_of_a_matrix.htm
|
||||||
$a = new SquareMatrix(4, 3,
|
$a = new SquareMatrix(4, 3,
|
||||||
3, 2);
|
3, 2);
|
||||||
|
|
||||||
$b = new SquareMatrix(-2, 3,
|
$b = new SquareMatrix(-2, 3,
|
||||||
3, -4);
|
3, -4);
|
||||||
|
|
||||||
$aInverse = $a->getInverse();
|
$aInverse = $a->getInverse();
|
||||||
$this->assertTrue($b->equals($aInverse));
|
$this->assertTrue($b->equals($aInverse));
|
||||||
@ -172,13 +168,13 @@ class MatrixTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertTrue($identity2x2->equals($aaInverse));
|
$this->assertTrue($identity2x2->equals($aaInverse));
|
||||||
|
|
||||||
$c = new SquareMatrix(1, 2, 3,
|
$c = new SquareMatrix(1, 2, 3,
|
||||||
0, 4, 5,
|
0, 4, 5,
|
||||||
1, 0, 6);
|
1, 0, 6);
|
||||||
|
|
||||||
$cInverse = $c->getInverse();
|
$cInverse = $c->getInverse();
|
||||||
$d = Matrix::scalarMultiply((1.0 / 22), new SquareMatrix(24, -12, -2,
|
$d = Matrix::scalarMultiply((1.0 / 22), new SquareMatrix(24, -12, -2,
|
||||||
5, 3, -5,
|
5, 3, -5,
|
||||||
-4, 2, 4));
|
-4, 2, 4));
|
||||||
|
|
||||||
|
|
||||||
$this->assertTrue($d->equals($cInverse));
|
$this->assertTrue($d->equals($cInverse));
|
||||||
@ -188,9 +184,3 @@ class MatrixTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertTrue($identity3x3->equals($ccInverse));
|
$this->assertTrue($identity3x3->equals($ccInverse));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$testSuite = new \PHPUnit_Framework_TestSuite();
|
|
||||||
$testSuite->addTest( new MatrixTest("testInverse"));
|
|
||||||
\PHPUnit_TextUI_TestRunner::run($testSuite);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
@ -1,12 +1,6 @@
|
|||||||
<?php
|
<?php namespace Moserware\Skills\Tests;
|
||||||
namespace Moserware\Skills;
|
|
||||||
|
|
||||||
require_once 'PHPUnit/Framework.php';
|
|
||||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
|
||||||
|
|
||||||
require_once(dirname(__FILE__) . '/../Skills/RankSorter.php');
|
|
||||||
|
|
||||||
|
|
||||||
|
use Moserware\Skills\RankSorter;
|
||||||
use \PHPUnit_Framework_TestCase;
|
use \PHPUnit_Framework_TestCase;
|
||||||
|
|
||||||
class RankSorterTest extends PHPUnit_Framework_TestCase
|
class RankSorterTest extends PHPUnit_Framework_TestCase
|
||||||
@ -29,5 +23,3 @@ class RankSorterTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
@ -1,10 +1,4 @@
|
|||||||
<?php
|
<?php namespace Moserware\Skills\Tests\TrueSkill;
|
||||||
namespace Moserware\Skills\TrueSkill;
|
|
||||||
|
|
||||||
require_once 'PHPUnit/Framework.php';
|
|
||||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
|
||||||
|
|
||||||
require_once(dirname(__FILE__) . '/../../Skills/TrueSkill/DrawMargin.php');
|
|
||||||
|
|
||||||
use \PHPUnit_Framework_TestCase;
|
use \PHPUnit_Framework_TestCase;
|
||||||
|
|
||||||
@ -27,10 +21,3 @@ class DrawMarginTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals($expected, $actual, '', DrawMarginTest::ERROR_TOLERANCE);
|
$this->assertEquals($expected, $actual, '', DrawMarginTest::ERROR_TOLERANCE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$testSuite = new \PHPUnit_Framework_TestSuite();
|
|
||||||
$testSuite->addTest( new DrawMarginTest( "testGetDrawMarginFromDrawProbability" ) );
|
|
||||||
\PHPUnit_TextUI_TestRunner::run($testSuite);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
<?php
|
<?php namespace Moserware\Skills\Tests\TrueSkill;
|
||||||
require_once 'PHPUnit/Framework.php';
|
|
||||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
|
||||||
|
|
||||||
require_once(dirname(__FILE__) . '/../../Skills/TrueSkill/FactorGraphTrueSkillCalculator.php');
|
|
||||||
require_once(dirname(__FILE__) . '/TrueSkillCalculatorTests.php');
|
|
||||||
|
|
||||||
use \PHPUnit_Framework_TestCase;
|
use \PHPUnit_Framework_TestCase;
|
||||||
use Moserware\Skills\TrueSkill\FactorGraphTrueSkillCalculator;
|
use Moserware\Skills\TrueSkill\FactorGraphTrueSkillCalculator;
|
||||||
@ -20,9 +15,3 @@ class FactorGraphTrueSkillCalculatorTest extends PHPUnit_Framework_TestCase
|
|||||||
TrueSkillCalculatorTests::testPartialPlayScenarios($this, $calculator);
|
TrueSkillCalculatorTests::testPartialPlayScenarios($this, $calculator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$testSuite = new \PHPUnit_Framework_TestSuite();
|
|
||||||
$testSuite->addTest( new FactorGraphTrueSkillCalculatorTest("testFactorGraphTrueSkillCalculator"));
|
|
||||||
|
|
||||||
\PHPUnit_TextUI_TestRunner::run($testSuite);
|
|
||||||
?>
|
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
<?php
|
<?php namespace Moserware\Skills\Tests\TrueSkill;
|
||||||
require_once(dirname(__FILE__) . "/../../Skills/GameInfo.php");
|
|
||||||
require_once(dirname(__FILE__) . "/../../Skills/Player.php");
|
|
||||||
require_once(dirname(__FILE__) . "/../../Skills/Rating.php");
|
|
||||||
require_once(dirname(__FILE__) . "/../../Skills/Team.php");
|
|
||||||
require_once(dirname(__FILE__) . "/../../Skills/Teams.php");
|
|
||||||
require_once(dirname(__FILE__) . "/../../Skills/SkillCalculator.php");
|
|
||||||
|
|
||||||
use Moserware\Skills\GameInfo;
|
use Moserware\Skills\GameInfo;
|
||||||
use Moserware\Skills\Player;
|
use Moserware\Skills\Player;
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
<?php
|
<?php namespace Moserware\Skills\Tests\TrueSkill;
|
||||||
require_once 'PHPUnit/Framework.php';
|
|
||||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
|
||||||
|
|
||||||
require_once(dirname(__FILE__) . '/../../Skills/TrueSkill/TwoPlayerTrueSkillCalculator.php');
|
|
||||||
require_once(dirname(__FILE__) . '/TrueSkillCalculatorTests.php');
|
|
||||||
|
|
||||||
use \PHPUnit_Framework_TestCase;
|
use \PHPUnit_Framework_TestCase;
|
||||||
use Moserware\Skills\TrueSkill\TwoPlayerTrueSkillCalculator;
|
use Moserware\Skills\TrueSkill\TwoPlayerTrueSkillCalculator;
|
||||||
@ -18,9 +13,3 @@ class TwoPlayerTrueSkillCalculatorTest extends PHPUnit_Framework_TestCase
|
|||||||
TrueSkillCalculatorTests::testAllTwoPlayerScenarios($this, $calculator);
|
TrueSkillCalculatorTests::testAllTwoPlayerScenarios($this, $calculator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$testSuite = new \PHPUnit_Framework_TestSuite();
|
|
||||||
$testSuite->addTest( new TwoPlayerTrueSkillCalculatorTest("testTwoPlayerTrueSkillCalculator"));
|
|
||||||
|
|
||||||
\PHPUnit_TextUI_TestRunner::run($testSuite);
|
|
||||||
?>
|
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
<?php
|
<?php namespace Moserware\Skills\Tests\TrueSkill;
|
||||||
require_once 'PHPUnit/Framework.php';
|
|
||||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
|
||||||
|
|
||||||
require_once(dirname(__FILE__) . '/../../Skills/TrueSkill/TwoTeamTrueSkillCalculator.php');
|
|
||||||
require_once(dirname(__FILE__) . '/TrueSkillCalculatorTests.php');
|
|
||||||
|
|
||||||
use \PHPUnit_Framework_TestCase;
|
use \PHPUnit_Framework_TestCase;
|
||||||
use Moserware\Skills\TrueSkill\TwoTeamTrueSkillCalculator;
|
use Moserware\Skills\TrueSkill\TwoTeamTrueSkillCalculator;
|
||||||
@ -19,9 +14,3 @@ class TwoTeamTrueSkillCalculatorTest extends PHPUnit_Framework_TestCase
|
|||||||
TrueSkillCalculatorTests::testAllTwoTeamScenarios($this, $calculator);
|
TrueSkillCalculatorTests::testAllTwoTeamScenarios($this, $calculator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$testSuite = new \PHPUnit_Framework_TestSuite();
|
|
||||||
$testSuite->addTest( new TwoTeamTrueSkillCalculatorTest("testTwoTeamTrueSkillCalculator"));
|
|
||||||
|
|
||||||
\PHPUnit_TextUI_TestRunner::run($testSuite);
|
|
||||||
?>
|
|
||||||
|
Reference in New Issue
Block a user