You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
1.9 KiB
Go

package day25
import (
"testing"
"gitea.paas.celticinfo.fr/oabrivard/aoc2023/utils"
)
func TestPart1(t *testing.T) {
lines := []string{
"jqt: rhn xhk nvd",
"rsh: frs pzl lsr",
"xhk: hfx",
"cmg: qnr nvd lhk bvb",
"rhn: xhk bvb hfx",
"bvb: xhk hfx",
"pzl: lsr hfx nvd",
"qnr: nvd",
"ntq: jqt hfx bvb xhk",
"nvd: lhk",
"lsr: lhk",
"rzs: qnr cmg lsr rsh",
"frs: qnr lhk lsr",
}
result := Part1(lines)
if result != 54 {
t.Fatalf("expected 54, got %d", result)
}
}
func TestPart1WithInput(t *testing.T) {
lines := utils.ReadLines("input.txt")
result := Part1(lines)
if result != 2402 {
t.Fatalf("expected 2402, got %d", result)
}
}
func TestPart1WithKerger(t *testing.T) {
/*
lines := []string{
"jqt: rhn xhk nvd",
"rsh: frs pzl lsr",
"xhk: hfx",
"cmg: qnr nvd lhk bvb",
"rhn: xhk bvb hfx",
"bvb: xhk hfx",
"pzl: lsr hfx nvd",
"qnr: nvd",
"ntq: jqt hfx bvb xhk",
"nvd: lhk",
"lsr: lhk",
"rzs: qnr cmg lsr rsh",
"frs: qnr lhk lsr",
}
*/
lines := []string{
"1: 2 3 4",
"2: 1 3 5",
"3: 1 2 4 5",
"4: 1 3",
"5: 2 3",
}
result := Part1WithKerger(lines)
if result != 54 {
t.Fatalf("expected 54, got %d", result)
}
}
func TestPart1WithKergerUF(t *testing.T) {
lines := []string{
"jqt: rhn xhk nvd",
"rsh: frs pzl lsr",
"xhk: hfx",
"cmg: qnr nvd lhk bvb",
"rhn: xhk bvb hfx",
"bvb: xhk hfx",
"pzl: lsr hfx nvd",
"qnr: nvd",
"ntq: jqt hfx bvb xhk",
"nvd: lhk",
"lsr: lhk",
"rzs: qnr cmg lsr rsh",
"frs: qnr lhk lsr",
}
/*
lines := []string{
"1: 2 3 4",
"2: 1 3 5",
"3: 1 2 4 5",
"4: 1 3",
"5: 2 3",
}
*/
result := Part1WithKergerUF(lines)
if result != 54 {
t.Fatalf("expected 54, got %d", result)
}
}
func TestPart1WithKergerUFWithInput(t *testing.T) {
lines := utils.ReadLines("input.txt")
result := Part1WithKergerUF(lines)
if result != 569904 {
t.Fatalf("expected 569904, got %d", result)
}
}