package day1 import ( "strings" "testing" "gitea.paas.celticinfo.fr/oabrivard/aoc2023/utils" ) func TestCalibrate(t *testing.T) { lines := []string{"1abc2", "pqr3stu8vwx", "a1b2c3d4e5f", "treb7uchet"} result := calibrate(lines) if result != 142 { t.Fatalf("expected 142, got %d", result) } } func TestCalibrateWithInput(t *testing.T) { lines := utils.ReadLines("input.txt") result := calibrate(lines) if result != 53921 { t.Fatalf("expected 53921, got %d", result) } } func TestCalibrate2(t *testing.T) { lines := strings.Split(`two1nine eightwothree abcone2threexyz xtwone3four 4nineeightseven2 zoneight234 7pqrstsixteen`, "\n") result := calibrate2(lines) if result != 281 { t.Fatalf("expected 281, got %d", result) } } func TestCalibrate2tmp(t *testing.T) { lines := strings.Split(`one two three four five six seven eight nine`, "\n") result := calibrate2(lines) if result != 495 { t.Fatalf("expected 495, got %d", result) } } func TestCalibrate2WithInput(t *testing.T) { lines := utils.ReadLines("input.txt") result := calibrate2(lines) if result != 54676 { t.Fatalf("expected 54676, got %d", result) } }