@ 2019-04-26T21:50:23Z <?php
namespace PokerHand;
use PHPUnit\Framework\TestCase;
class PokerHandTest extends TestCase
{
/**
* @test
*/
public function itCanRankARoyalFlush()
{
$hand = new PokerHand('As Ks Qs Js 10s');
$this->assertEquals('Royal Flush', $hand->getRank());
}
/**
* @test
*/
public function itCanRankAStraightFlush()
{
$hand = new PokerHand('8s 7s 6s 5s 4s');
$this->assertEquals('Straight Flush', $hand->getRank());
}
/**
* @test
*/
public function itCanRankAFourOfAKind()
{
$hand = new PokerHand('Js Jc Jd Jh 7s');
$this->assertEquals('Four of a Kind', $hand->getRank());
}
/**
* @test
*/
public function itCanRankFullHouse()
{
$hand = new PokerHand('10s 10d 10c 9s 9d');
$this->assertEquals('Full House', $hand->getRank());
}
/**
* @test
*/
public function itCanRankAFlush()
{
$hand = new PokerHand('Kh Qh 6h 2h 9h');
$this->assertEquals('Flush', $hand->getRank());
}
/**
* @test
*/
public function itCanRankAStraight()
{
$hand = new PokerHand('9c 8d 7s 6d 5h');
$this->assertEquals('Straight', $hand->getRank());
}
/**
* @test
*/
public function itCanRankAThreeOfAKindh()
{
$hand = new PokerHand('7c 7d 7s Ks 3s');
$this->assertEquals('Three of a Kind', $hand->getRank());
}
/**
* @test
*/
public function itCanRankATwoPair()
{
$hand = new PokerHand('Kh Kc 3s 3h 2d');
$this->assertEquals('Two Pair', $hand->getRank());
}
/**
* @test
*/
public function itCanRankAOnePair()
{
$hand = new PokerHand('Ah As 10c 7d 6s');
$this->assertEquals('One Pair', $hand->getRank());
}
/**
* @test
*/
public function itCanRankAHighCard()
{
$hand = new PokerHand('9h 6c 7d 2s Qh');
$this->assertEquals('High Card', $hand->getRank());
}
}
$ composer test-poker
> phpunit --verbose --colors=always test/PokerHandTest.php
.......... 10 / 10 (100%)
Time: 50 ms, Memory: 4.00MB
OK (10 tests, 10 assertions)
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 7.3.4 0.004 0.007 14.71 7.3.3 0.008 0.012 14.61 7.3.2 0.005 0.009 16.47 7.3.1 0.014 0.008 16.41 7.3.0 0.010 0.000 16.59 7.2.17 0.004 0.008 14.61 7.2.16 0.010 0.006 14.86 7.2.15 0.015 0.006 16.82 7.2.14 0.006 0.006 16.71 7.2.13 0.017 0.007 16.63 7.2.12 0.013 0.010 16.68 7.2.11 0.011 0.011 16.46 7.2.10 0.004 0.014 16.76 7.2.9 0.011 0.011 16.77 7.2.8 0.004 0.008 16.52 7.2.7 0.015 0.007 16.77 7.2.6 0.014 0.006 16.80 7.2.5 0.012 0.009 16.45 7.2.4 0.013 0.007 16.50 7.2.3 0.011 0.004 16.87 7.2.2 0.007 0.007 16.75 7.2.1 0.008 0.004 16.26 7.2.0 0.007 0.003 16.67 7.1.28 0.000 0.010 15.48 7.1.27 0.003 0.007 15.48 7.1.26 0.006 0.003 15.52 7.1.25 0.003 0.017 15.30
preferences:dark mode live preview
142.67 ms | 1394 KiB | 7 Q