mirror of
https://github.com/onyx-and-iris/aoc2023.git
synced 2024-11-15 15:10:49 +00:00
cleanup test compare
This commit is contained in:
parent
15af19f442
commit
c47f06b8e7
@ -11,27 +11,15 @@ import (
|
|||||||
func TestCompare(t *testing.T) {
|
func TestCompare(t *testing.T) {
|
||||||
//t.Skip("skipping test")
|
//t.Skip("skipping test")
|
||||||
|
|
||||||
input := []string{
|
winning1 := "41 48 83 86 17"
|
||||||
"Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53",
|
mynums1 := "83 86 6 31 17 9 48 53"
|
||||||
"Card 2: 13 32 20 16 61 | 61 30 68 82 17 32 24 19",
|
|
||||||
}
|
|
||||||
|
|
||||||
winning1, mynums1 := func() (string, string) {
|
winning2 := "13 32 20 16 61"
|
||||||
y := strings.Split(input[0], ":")
|
mynums2 := "61 30 68 82 17 32 24 19"
|
||||||
z := strings.Split(y[1], "|")
|
|
||||||
return z[0], z[1]
|
|
||||||
}()
|
|
||||||
|
|
||||||
winning2, mynums2 := func() (string, string) {
|
|
||||||
y := strings.Split(input[1], ":")
|
|
||||||
z := strings.Split(y[1], "|")
|
|
||||||
return z[0], z[1]
|
|
||||||
}()
|
|
||||||
|
|
||||||
f := func(c rune) bool {
|
f := func(c rune) bool {
|
||||||
return !unicode.IsDigit(c)
|
return !unicode.IsDigit(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
res1, _ := compare(strings.FieldsFunc(winning1, f), strings.FieldsFunc(mynums1, f))
|
res1, _ := compare(strings.FieldsFunc(winning1, f), strings.FieldsFunc(mynums1, f))
|
||||||
res2, _ := compare(strings.FieldsFunc(winning2, f), strings.FieldsFunc(mynums2, f))
|
res2, _ := compare(strings.FieldsFunc(winning2, f), strings.FieldsFunc(mynums2, f))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user