Advertisement
Guest User

ewfwefw

a guest
Feb 23rd, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 1.04 KB | None | 0 0
  1. package model
  2.  
  3. import org.scalatest.FunSpec
  4. import org.scalatest.Matchers._
  5. import overpoker.model._
  6. import Rank._
  7.  
  8. class DeckTest extends FunSpec{
  9.  
  10.   import TestDeck._
  11.  
  12.   val deck = Deck(Ace of Spades, King of Spades, 5 of Hearts, 2 of Spades, Jack of Clubs)
  13.  
  14.   it("should create a deck with a full pack of cards"){
  15.       Deck.fullDeck.size should be(52)
  16.   }
  17.  
  18.   it("should draw cards and return a new deck sans the picked cards"){
  19.     val twoCards = 2
  20.     val (drawn, newDeck) = deck draw twoCards
  21.  
  22.     newDeck.size should be(deck.size -twoCards)
  23.     newDeck.cards.head should be(5 of Hearts)
  24.  
  25.     drawn should (contain(Ace of Spades) and contain(King of Spades))
  26.   }
  27.  
  28.   it("should be able to deal a flop"){
  29.     val (cards, newDeck) = deck.flop
  30.     cards should (contain(Ace of Spades) and contain(King of Spades) and contain(5 of Hearts))
  31.   }
  32.  
  33.   it("should sort cards by rank"){
  34.     val deck = Deck(Ace of Spades, 2 of Clubs, 10 of Hearts)
  35.     deck.sortedByRank should be(Vector(Ace of Spades,10 of Hearts, 2 of Clubs))
  36.   }
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement