first version of sanity tests passing

master^2
Jeffrey Paul 5 years ago
parent 032b64b4cb
commit ee32ef0cb1
  1. 4
      Makefile
  2. 10
      pokercore/Makefile
  3. 1
      pokercore/pokercore.go
  4. 19
      pokercore/pokercore_test.go

@ -0,0 +1,4 @@
default: test
test:
cd pokercore && make test

@ -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…
Cancel
Save