mirror of
https://github.com/onyx-and-iris/aoc2023.git
synced 2024-11-25 03:40:49 +00:00
104 lines
2.1 KiB
Go
104 lines
2.1 KiB
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func TestPromoteHighCard(t *testing.T) {
|
||
|
//t.Skip("skipping test")
|
||
|
|
||
|
h := newHand("1234J", 0)
|
||
|
promote(h)
|
||
|
|
||
|
t.Run("Should promote to onepair", func(t *testing.T) {
|
||
|
assert.Equal(t, onepair, h.kind())
|
||
|
})
|
||
|
}
|
||
|
|
||
|
func TestPromoteOnePair(t *testing.T) {
|
||
|
//t.Skip("skipping test")
|
||
|
|
||
|
h1 := newHand("1233J", 0)
|
||
|
promote(h1)
|
||
|
h2 := newHand("123JJ", 0)
|
||
|
promote(h2)
|
||
|
|
||
|
t.Run("Should promote to threeofakind", func(t *testing.T) {
|
||
|
assert.Equal(t, threeofakind, h1.kind())
|
||
|
})
|
||
|
|
||
|
t.Run("Should promote to threeofakind", func(t *testing.T) {
|
||
|
assert.Equal(t, threeofakind, h2.kind())
|
||
|
})
|
||
|
}
|
||
|
|
||
|
func TestPromoteTwoPair(t *testing.T) {
|
||
|
//t.Skip("skipping test")
|
||
|
|
||
|
h1 := newHand("1133J", 0)
|
||
|
promote(h1)
|
||
|
h2 := newHand("133JJ", 0)
|
||
|
promote(h2)
|
||
|
|
||
|
t.Run("Should promote to fullhouse", func(t *testing.T) {
|
||
|
assert.Equal(t, fullhouse, h1.kind())
|
||
|
})
|
||
|
|
||
|
t.Run("Should promote to fourofakind", func(t *testing.T) {
|
||
|
assert.Equal(t, fourofakind, h2.kind())
|
||
|
})
|
||
|
}
|
||
|
|
||
|
func TestPromoteThreeOfAKind(t *testing.T) {
|
||
|
//t.Skip("skipping test")
|
||
|
|
||
|
h1 := newHand("1333J", 0)
|
||
|
promote(h1)
|
||
|
h2 := newHand("13JJJ", 0)
|
||
|
promote(h2)
|
||
|
|
||
|
t.Run("Should promote to fourofakind", func(t *testing.T) {
|
||
|
assert.Equal(t, fourofakind, h1.kind())
|
||
|
})
|
||
|
|
||
|
t.Run("Should promote to fourofakind", func(t *testing.T) {
|
||
|
assert.Equal(t, fourofakind, h2.kind())
|
||
|
})
|
||
|
}
|
||
|
|
||
|
func TestPromoteFullHOuse(t *testing.T) {
|
||
|
//t.Skip("skipping test")
|
||
|
|
||
|
h1 := newHand("J333J", 0)
|
||
|
promote(h1)
|
||
|
h2 := newHand("33JJJ", 0)
|
||
|
promote(h2)
|
||
|
|
||
|
t.Run("Should promote to fiveofakind", func(t *testing.T) {
|
||
|
assert.Equal(t, fiveofakind, h1.kind())
|
||
|
})
|
||
|
|
||
|
t.Run("Should promote to fiveofakind", func(t *testing.T) {
|
||
|
assert.Equal(t, fiveofakind, h2.kind())
|
||
|
})
|
||
|
}
|
||
|
|
||
|
func TestPromoteFourOfAKind(t *testing.T) {
|
||
|
//t.Skip("skipping test")
|
||
|
|
||
|
h1 := newHand("JJJJ3", 0)
|
||
|
promote(h1)
|
||
|
h2 := newHand("3333J", 0)
|
||
|
promote(h2)
|
||
|
|
||
|
t.Run("Should promote to fiveofakind", func(t *testing.T) {
|
||
|
assert.Equal(t, fiveofakind, h1.kind())
|
||
|
})
|
||
|
|
||
|
t.Run("Should promote to fiveofakind", func(t *testing.T) {
|
||
|
assert.Equal(t, fiveofakind, h2.kind())
|
||
|
})
|
||
|
}
|