mirror of
https://github.com/brianstrauch/solitaire-tui.git
synced 2024-12-26 21:58:44 +01:00
27 lines
853 B
Go
27 lines
853 B
Go
package pkg
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestNewDeck(t *testing.T) {
|
|
deck := NewFullDeck()
|
|
|
|
expected := TestDeck(
|
|
"A♠?", "2♠?", "3♠?", "4♠?", "5♠?", "6♠?", "7♠?", "8♠?", "9♠?", "10♠?", "J♠?", "Q♠?", "K♠?",
|
|
"A♦?", "2♦?", "3♦?", "4♦?", "5♦?", "6♦?", "7♦?", "8♦?", "9♦?", "10♦?", "J♦?", "Q♦?", "K♦?",
|
|
"A♥?", "2♥?", "3♥?", "4♥?", "5♥?", "6♥?", "7♥?", "8♥?", "9♥?", "10♥?", "J♥?", "Q♥?", "K♥?",
|
|
"A♣?", "2♣?", "3♣?", "4♣?", "5♣?", "6♣?", "7♣?", "8♣?", "9♣?", "10♣?", "J♣?", "Q♣?", "K♣?",
|
|
)
|
|
|
|
require.ElementsMatch(t, expected.cards, deck.cards)
|
|
}
|
|
|
|
func TestShuffle(t *testing.T) {
|
|
deck := TestDeck("A♠", "2♠")
|
|
deck.Shuffle()
|
|
|
|
require.ElementsMatch(t, TestDeck("A♠", "2♠").cards, deck.cards)
|
|
}
|