diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d0ae92e --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +default: test + +test: + cd pokercore && make test diff --git a/pokercore/Makefile b/pokercore/Makefile new file mode 100644 index 0000000..9772059 --- /dev/null +++ b/pokercore/Makefile @@ -0,0 +1,10 @@ +default: test + +.PHONY: pkgs test + +fetch: + go get -t + +test: *.go + go test -v + diff --git a/pokercore/pokercore.go b/pokercore/pokercore.go index 046a640..303d45f 100644 --- a/pokercore/pokercore.go +++ b/pokercore/pokercore.go @@ -204,4 +204,5 @@ func scorePokerHand(input Cards) (score int) { */ + return 1 } diff --git a/pokercore/pokercore_test.go b/pokercore/pokercore_test.go index 71b0620..24077ba 100644 --- a/pokercore/pokercore_test.go +++ b/pokercore/pokercore_test.go @@ -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) + }