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
|
||||
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');
|
||||
<?php namespace Moserware\Skills\Tests\Elo;
|
||||
|
||||
use Moserware\Skills\GameInfo;
|
||||
use Moserware\Skills\PairwiseComparison;
|
||||
@ -25,8 +20,8 @@ class EloAssert
|
||||
$player2 = "Player2";
|
||||
|
||||
$teams = array(
|
||||
array( $player1 => new EloRating($player1BeforeRating) ),
|
||||
array( $player2 => new EloRating($player2BeforeRating) )
|
||||
array($player1 => new EloRating($player1BeforeRating)),
|
||||
array($player2 => new EloRating($player2BeforeRating))
|
||||
);
|
||||
|
||||
$chessGameInfo = new GameInfo(1200, 0, 200);
|
||||
@ -42,5 +37,3 @@ class EloAssert
|
||||
$testClass->assertEquals($player2AfterRating, $result[$player2]->getMean(), '', self::ERROR_TOLERANCE);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
@ -1,13 +1,8 @@
|
||||
<?php
|
||||
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');
|
||||
<?php namespace Moserware\Skills\Tests\Elo;
|
||||
|
||||
use Moserware\Skills\Elo\FideEloCalculator;
|
||||
use Moserware\Skills\Elo\ProvisionalFideKFactor;
|
||||
use Moserware\Skills\PairwiseComparison;
|
||||
use \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);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
@ -1,15 +1,11 @@
|
||||
<?php
|
||||
require_once 'PHPUnit/Framework.php';
|
||||
require_once(dirname(__FILE__) . '/../../Skills/Numerics/BasicMath.php');
|
||||
|
||||
<?php namespace Moserware\Skills\Tests\Numerics;
|
||||
|
||||
class BasicMathTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testSquare()
|
||||
{
|
||||
$this->assertEquals( 1, Moserware\Numerics\square(1) );
|
||||
$this->assertEquals( 1.44, Moserware\Numerics\square(1.2) );
|
||||
$this->assertEquals( 4, Moserware\Numerics\square(2) );
|
||||
$this->assertEquals(1, Moserware\Numerics\square(1));
|
||||
$this->assertEquals(1.44, Moserware\Numerics\square(1.2));
|
||||
$this->assertEquals(4, Moserware\Numerics\square(2));
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,11 +1,4 @@
|
||||
<?php
|
||||
namespace Moserware\Numerics;
|
||||
|
||||
require_once 'PHPUnit/Framework.php';
|
||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||
|
||||
require_once(dirname(__FILE__) . '/../../Skills/Numerics/GaussianDistribution.php');
|
||||
|
||||
<?php namespace Moserware\Skills\Tests\Numerics;
|
||||
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
|
||||
@ -101,6 +94,3 @@ class GaussianDistributionTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(0.4330127018922193, $absDiff2, '', GaussianDistributionTest::ERROR_TOLERANCE);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
@ -1,8 +1,4 @@
|
||||
<?php
|
||||
require_once 'PHPUnit/Framework.php';
|
||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||
|
||||
require_once(dirname(__FILE__) . '/../../Skills/Numerics/Matrix.php');
|
||||
<?php namespace Moserware\Skills\Tests;
|
||||
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
use Moserware\Numerics\Matrix;
|
||||
@ -51,7 +47,7 @@ class MatrixTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
public function testFourByFourDeterminant()
|
||||
{
|
||||
$a = new SquareMatrix( 1, 2, 3, 4,
|
||||
$a = new SquareMatrix(1, 2, 3, 4,
|
||||
5, 6, 7, 8,
|
||||
9, 10, 11, 12,
|
||||
13, 14, 15, 16);
|
||||
@ -69,7 +65,7 @@ class MatrixTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
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,
|
||||
17, 18, 19, 20, 21, 22, 23, 24,
|
||||
25, 26, 27, 28, 29, 30, 31, 32,
|
||||
@ -137,7 +133,7 @@ class MatrixTest extends PHPUnit_Framework_TestCase
|
||||
$a = new SquareMatrix(1, 2,
|
||||
3, 4);
|
||||
|
||||
$b = new SquareMatrix( 4, -2,
|
||||
$b = new SquareMatrix(4, -2,
|
||||
-3, 1);
|
||||
|
||||
$this->assertTrue($b->equals($a->getAdjugate()));
|
||||
@ -188,9 +184,3 @@ class MatrixTest extends PHPUnit_Framework_TestCase
|
||||
$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
|
||||
namespace Moserware\Skills;
|
||||
|
||||
require_once 'PHPUnit/Framework.php';
|
||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||
|
||||
require_once(dirname(__FILE__) . '/../Skills/RankSorter.php');
|
||||
|
||||
<?php namespace Moserware\Skills\Tests;
|
||||
|
||||
use Moserware\Skills\RankSorter;
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
|
||||
class RankSorterTest extends PHPUnit_Framework_TestCase
|
||||
@ -29,5 +23,3 @@ class RankSorterTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,10 +1,4 @@
|
||||
<?php
|
||||
namespace Moserware\Skills\TrueSkill;
|
||||
|
||||
require_once 'PHPUnit/Framework.php';
|
||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||
|
||||
require_once(dirname(__FILE__) . '/../../Skills/TrueSkill/DrawMargin.php');
|
||||
<?php namespace Moserware\Skills\Tests\TrueSkill;
|
||||
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
|
||||
@ -27,10 +21,3 @@ class DrawMarginTest extends PHPUnit_Framework_TestCase
|
||||
$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
|
||||
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');
|
||||
<?php namespace Moserware\Skills\Tests\TrueSkill;
|
||||
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
use Moserware\Skills\TrueSkill\FactorGraphTrueSkillCalculator;
|
||||
@ -20,9 +15,3 @@ class FactorGraphTrueSkillCalculatorTest extends PHPUnit_Framework_TestCase
|
||||
TrueSkillCalculatorTests::testPartialPlayScenarios($this, $calculator);
|
||||
}
|
||||
}
|
||||
|
||||
$testSuite = new \PHPUnit_Framework_TestSuite();
|
||||
$testSuite->addTest( new FactorGraphTrueSkillCalculatorTest("testFactorGraphTrueSkillCalculator"));
|
||||
|
||||
\PHPUnit_TextUI_TestRunner::run($testSuite);
|
||||
?>
|
||||
|
@ -1,10 +1,4 @@
|
||||
<?php
|
||||
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");
|
||||
<?php namespace Moserware\Skills\Tests\TrueSkill;
|
||||
|
||||
use Moserware\Skills\GameInfo;
|
||||
use Moserware\Skills\Player;
|
||||
|
@ -1,9 +1,4 @@
|
||||
<?php
|
||||
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');
|
||||
<?php namespace Moserware\Skills\Tests\TrueSkill;
|
||||
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
use Moserware\Skills\TrueSkill\TwoPlayerTrueSkillCalculator;
|
||||
@ -18,9 +13,3 @@ class TwoPlayerTrueSkillCalculatorTest extends PHPUnit_Framework_TestCase
|
||||
TrueSkillCalculatorTests::testAllTwoPlayerScenarios($this, $calculator);
|
||||
}
|
||||
}
|
||||
|
||||
$testSuite = new \PHPUnit_Framework_TestSuite();
|
||||
$testSuite->addTest( new TwoPlayerTrueSkillCalculatorTest("testTwoPlayerTrueSkillCalculator"));
|
||||
|
||||
\PHPUnit_TextUI_TestRunner::run($testSuite);
|
||||
?>
|
||||
|
@ -1,9 +1,4 @@
|
||||
<?php
|
||||
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');
|
||||
<?php namespace Moserware\Skills\Tests\TrueSkill;
|
||||
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
use Moserware\Skills\TrueSkill\TwoTeamTrueSkillCalculator;
|
||||
@ -19,9 +14,3 @@ class TwoTeamTrueSkillCalculatorTest extends PHPUnit_Framework_TestCase
|
||||
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