@ 2019-04-26T21:49:59Z <?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
PHPUnit 7.3.5 by Sebastian Bergmann and contributors.
Runtime: PHP 7.2.17-0ubuntu0.18.04.1 with Xdebug 2.6.0
.......... 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.000 0.011 14.66 7.3.3 0.006 0.010 14.65 7.3.2 0.012 0.009 16.64 7.3.1 0.018 0.003 16.41 7.3.0 0.000 0.012 16.45 7.2.17 0.020 0.003 14.88 7.2.16 0.006 0.006 14.85 7.2.15 0.003 0.010 16.66 7.2.14 0.009 0.006 16.78 7.2.13 0.005 0.005 16.77 7.2.12 0.006 0.006 16.49 7.2.11 0.010 0.003 16.43 7.2.10 0.003 0.010 16.77 7.2.9 0.010 0.003 16.61 7.2.8 0.003 0.010 16.83 7.2.7 0.006 0.006 16.47 7.2.6 0.012 0.000 16.63 7.2.5 0.010 0.003 16.65 7.2.4 0.009 0.004 16.80 7.2.3 0.007 0.004 16.73 7.2.2 0.006 0.006 16.56 7.2.1 0.013 0.000 16.63 7.2.0 0.003 0.010 16.82 7.1.28 0.007 0.010 15.57 7.1.27 0.014 0.000 15.50 7.1.26 0.007 0.003 15.46 7.1.25 0.000 0.010 15.75
preferences:dark mode live preview
142.61 ms | 1394 KiB | 7 Q