Пример #1
0
  @Test
  public void HighCard() {
    Deck d = new Deck();
    Hand h = new Hand();
    h.AddCardToHand(new Card(eSuit.CLUBS, eRank.TEN, 0));
    h.AddCardToHand(new Card(eSuit.DIAMONDS, eRank.KING, 0));
    h.AddCardToHand(new Card(eSuit.SPADES, eRank.THREE, 0));
    h.AddCardToHand(new Card(eSuit.HEARTS, eRank.TWO, 0));
    h.AddCardToHand(new Card(eSuit.CLUBS, eRank.ACE, 0));
    h.EvalHand();

    assertTrue(h.getHandStrength() == eHandStrength.HighCard.getHandStrength());
    assertTrue(h.getHighPairStrength() == eRank.ACE.getRank());
    assertTrue(h.getLowPairStrength() == 0);
    assertTrue(h.getKicker().size() == 4);

    Card c1 = h.getKicker().get(eCardNo.FirstCard.getCardNo());
    Card c2 = h.getKicker().get(eCardNo.SecondCard.getCardNo());
    Card c3 = h.getKicker().get(eCardNo.ThirdCard.getCardNo());
    Card c4 = h.getKicker().get(eCardNo.FourthCard.getCardNo());

    //	Check value of kicker
    assertTrue(c1.getRank().getRank() == eRank.KING.getRank());

    //	Check value of kicker
    assertTrue(c2.getRank().getRank() == eRank.TEN.getRank());

    //	Check value of kicker
    assertTrue(c3.getRank().getRank() == eRank.THREE.getRank());

    //	Check value of kicker
    assertTrue(c4.getRank().getRank() == eRank.TWO.getRank());
  }
Пример #2
0
  @Test
  public void ThreeOfAKind_2() {
    Deck d = new Deck();
    Hand h = new Hand();
    h.AddCardToHand(new Card(eSuit.CLUBS, eRank.TEN, 0));
    h.AddCardToHand(new Card(eSuit.DIAMONDS, eRank.TEN, 0));
    h.AddCardToHand(new Card(eSuit.SPADES, eRank.TEN, 0));
    h.AddCardToHand(new Card(eSuit.HEARTS, eRank.KING, 0));
    h.AddCardToHand(new Card(eSuit.CLUBS, eRank.NINE, 0));
    h.EvalHand();

    assertTrue(h.getHandStrength() == eHandStrength.ThreeOfAKind.getHandStrength());
    assertTrue(h.getHighPairStrength() == eRank.TEN.getRank());
    assertTrue(h.getLowPairStrength() == 0);
    assertTrue(h.getKicker().size() == 2);

    Card c1 = h.getKicker().get(eCardNo.FirstCard.getCardNo());
    Card c2 = h.getKicker().get(eCardNo.SecondCard.getCardNo());

    //	Check to see if the first kicker is a KING
    assertTrue(c1.getRank().getRank() == eRank.KING.getRank());

    //	Check to see if the second kicker is a NINE
    assertTrue(c2.getRank().getRank() == eRank.NINE.getRank());
  }
Пример #3
0
  @Test
  public void Straight() {
    Deck d = new Deck();
    Hand h = new Hand();
    h.AddCardToHand(new Card(eSuit.CLUBS, eRank.TEN, 0));
    h.AddCardToHand(new Card(eSuit.DIAMONDS, eRank.JACK, 0));
    h.AddCardToHand(new Card(eSuit.CLUBS, eRank.QUEEN, 0));
    h.AddCardToHand(new Card(eSuit.CLUBS, eRank.KING, 0));
    h.AddCardToHand(new Card(eSuit.CLUBS, eRank.NINE, 0));
    h.EvalHand();

    assertTrue(h.getHandStrength() == eHandStrength.Straight.getHandStrength());
    assertTrue(h.getHighPairStrength() == eRank.KING.getRank());
    assertTrue(h.getLowPairStrength() == 0);
    assertTrue(h.getKicker() == null);
  }