@ 2019-04-26T21:50:17Z <?php
<?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.011 0.009 14.76 7.3.3 0.017 0.003 14.74 7.3.2 0.012 0.009 16.58 7.3.1 0.009 0.012 16.54 7.3.0 0.003 0.020 16.41 7.2.17 0.007 0.014 14.72 7.2.16 0.008 0.011 14.79 7.2.15 0.019 0.003 16.41 7.2.14 0.010 0.007 16.45 7.2.13 0.003 0.022 16.68 7.2.12 0.006 0.009 16.66 7.2.11 0.009 0.006 16.57 7.2.10 0.013 0.009 16.54 7.2.9 0.006 0.006 16.93 7.2.8 0.003 0.009 16.44 7.2.7 0.004 0.008 16.73 7.2.6 0.009 0.013 16.73 7.2.5 0.013 0.000 16.72 7.2.4 0.007 0.003 16.37 7.2.3 0.009 0.003 16.68 7.2.2 0.015 0.009 16.60 7.2.1 0.016 0.006 16.79 7.2.0 0.010 0.006 16.35 7.1.28 0.012 0.008 15.49 7.1.27 0.010 0.010 15.46 7.1.26 0.010 0.000 15.50 7.1.25 0.010 0.014 15.35
preferences:dark mode live preview
146.4 ms | 1394 KiB | 7 Q