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.

68 lines
1.1 KiB
Go

package day3
import (
"testing"
"gitea.paas.celticinfo.fr/oabrivard/aoc2023/utils"
)
func TestPartNumberSum(t *testing.T) {
lines := []string{
"467..114..",
"...*......",
"..35..633.",
"......#...",
"617*......",
".....+.58.",
"..592.....",
"......755.",
"...$.*....",
".664.598..",
}
result := PartNumberSum(lines)
if result != 4361 {
t.Fatalf("expected 4361, got %d", result)
}
}
func TestPartNumberWithInput(t *testing.T) {
lines := utils.ReadLines("input.txt")
result := PartNumberSum(lines)
if result != 532331 {
t.Fatalf("expected 532331, got %d", result)
}
}
func TestGearRatioSum(t *testing.T) {
lines := []string{
"467..114..",
"...*......",
"..35..633.",
"......#...",
"617*......",
".....+.58.",
"..592.....",
"......755.",
"...$.*....",
".664.598..",
}
result := GearRatioSum(lines)
if result != 467835 {
t.Fatalf("expected 467835, got %d", result)
}
}
func TestGearRatioSumWithInput(t *testing.T) {
lines := utils.ReadLines("input.txt")
result := GearRatioSum(lines)
if result != 82301120 {
t.Fatalf("expected 82301120, got %d", result)
}
}