mirror of
				https://github.com/furyfire/trueskill.git
				synced 2025-11-04 10:12:28 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			33 lines
		
	
	
		
			939 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			939 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
require_once 'PHPUnit/Framework.php';
 | 
						|
require_once 'PHPUnit/TextUI/TestRunner.php';
 | 
						|
 | 
						|
require_once(dirname(__FILE__) . '/../PHPSkills/RankSorter.php');
 | 
						|
 | 
						|
 | 
						|
use \PHPUnit_Framework_TestCase;
 | 
						|
 
 | 
						|
class RankSorterTest extends PHPUnit_Framework_TestCase
 | 
						|
{
 | 
						|
    public function testSort()
 | 
						|
    {
 | 
						|
        $team1 = array( "a" => 1, "b" => 2 );
 | 
						|
        $team2 = array( "c" => 3, "d" => 4 );
 | 
						|
        $team3 = array( "e" => 5, "f" => 6 );
 | 
						|
        
 | 
						|
        $teams = array($team1, $team2, $team3);
 | 
						|
        
 | 
						|
        $teamRanks = array(3, 1, 2);
 | 
						|
        
 | 
						|
        $sortedRanks = RankSorter::sort($teams, $teamRanks);
 | 
						|
        
 | 
						|
        $this->assertEquals($team2, $sortedRanks[0]);        
 | 
						|
        $this->assertEquals($team3, $sortedRanks[1]);
 | 
						|
        $this->assertEquals($team1, $sortedRanks[2]);
 | 
						|
        
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
$testSuite = new \PHPUnit_Framework_TestSuite();
 | 
						|
$testSuite->addTest( new RankSorterTest("testSort"));
 | 
						|
 | 
						|
\PHPUnit_TextUI_TestRunner::run($testSuite); |