2024-01-07 00:09:47 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-01-07 02:33:45 +00:00
|
|
|
"math/rand"
|
2024-01-07 00:09:47 +00:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestCards(t *testing.T) {
|
|
|
|
d := Deck()
|
|
|
|
|
2024-01-07 01:51:06 +00:00
|
|
|
assert.Len(t, d, DeckSize)
|
2024-01-07 00:09:47 +00:00
|
|
|
assert.EqualValues(t, []Card{0, 0, 0, 0, 0, 0, 15, 15, 20, 20, 25, 25, 30, 30, 35, 35, 40, 40, 45, 45, 50, 50, 55, 55, 60, 60, 65, 65, 16, 16, 21, 21, 26, 26, 31, 31, 36, 36, 41, 41, 46, 46, 51, 51, 56, 56, 61, 61, 66, 66, 17, 17, 22, 22, 27, 27, 32, 32, 37, 37, 42, 42, 47, 47, 52, 52, 57, 57, 62, 62, 67, 67, 18, 18, 23, 23, 28, 28, 33, 33, 38, 38, 43, 43, 48, 48, 53, 53, 58, 58, 63, 63, 68, 68, 19, 19, 24, 24, 29, 29, 34, 34, 39, 39, 44, 44, 49, 49, 54, 54, 59, 59, 64, 64, 69, 69}, d)
|
|
|
|
|
2024-01-07 02:33:45 +00:00
|
|
|
entropy := rand.New(rand.NewSource(0xdeadbeef))
|
|
|
|
|
|
|
|
Shuffle(d, entropy)
|
2024-01-07 00:09:47 +00:00
|
|
|
|
2024-01-07 01:51:06 +00:00
|
|
|
assert.Len(t, d, DeckSize)
|
2024-01-07 02:33:45 +00:00
|
|
|
assert.EqualValues(t, []Card{50, 47, 24, 25, 22, 61, 33, 66, 36, 41, 16, 18, 58, 31, 16, 48, 38, 39, 33, 17, 0, 15, 32, 68, 23, 67, 27, 18, 22, 0, 46, 45, 31, 65, 60, 28, 68, 51, 26, 63, 41, 53, 65, 42, 59, 56, 40, 55, 30, 54, 57, 66, 61, 26, 51, 49, 55, 46, 35, 44, 42, 24, 45, 52, 59, 39, 19, 30, 36, 47, 49, 56, 0, 32, 62, 67, 50, 37, 58, 21, 69, 48, 53, 23, 57, 64, 34, 0, 21, 43, 27, 0, 64, 52, 60, 69, 17, 63, 35, 44, 25, 20, 43, 29, 19, 38, 34, 15, 54, 29, 28, 37, 20, 0, 62, 40}, d)
|
2024-01-07 00:09:47 +00:00
|
|
|
}
|