first version of sanity tests passing
This commit is contained in:
parent
032b64b4cb
commit
ee32ef0cb1
10
pokercore/Makefile
Normal file
10
pokercore/Makefile
Normal file
@ -0,0 +1,10 @@
|
||||
default: test
|
||||
|
||||
.PHONY: pkgs test
|
||||
|
||||
fetch:
|
||||
go get -t
|
||||
|
||||
test: *.go
|
||||
go test -v
|
||||
|
@ -204,4 +204,5 @@ func scorePokerHand(input Cards) (score int) {
|
||||
|
||||
|
||||
*/
|
||||
return 1
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package pokercore
|
||||
|
||||
import "github.com/stretchr/testify/assert"
|
||||
import "testing"
|
||||
|
||||
type ShuffleTestResults []struct {
|
||||
@ -14,14 +15,16 @@ func TestPokerHand(t *testing.T) {
|
||||
cards := d.Deal(7)
|
||||
//expected := "7C,5S,QS,2D,6D,QC,3H"
|
||||
expected := "7♣,5♠,Q♠,2♦,6♦,Q♣,3♥"
|
||||
if s := cards.String(); s != expected {
|
||||
t.Errorf("didn't get expected cards, got %s", s)
|
||||
} else {
|
||||
t.Logf("got expected cards %s", s)
|
||||
}
|
||||
assert.Equal(t, cards.String(), expected)
|
||||
|
||||
x := d.Remaining()
|
||||
if x != 45 {
|
||||
t.Errorf("expected 45 left, got %d", x)
|
||||
}
|
||||
assert.Equal(t, 45, x)
|
||||
|
||||
d.ShuffleDeterministically(123456789)
|
||||
cards = d.Deal(10)
|
||||
expected = "2♣,T♠,4♥,Q♣,9♦,7♥,7♠,6♥,5♥,5♠"
|
||||
assert.Equal(t, expected, cards.String())
|
||||
x = d.Remaining()
|
||||
assert.Equal(t, 42, x)
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user