advent-of-code/2023/day-1/part-2/main_test.go
2023-12-01 15:03:51 +00:00

27 lines
438 B
Go

package main
import (
"bytes"
"testing"
)
func TestCalculateSumCalibrationValues(t *testing.T) {
testStr := `
two1nine
eightwothree
abcone2threexyz
xtwone3four
4nineeightseven2
zoneight234
7pqrstsixteen
`
buf := bytes.NewBuffer([]byte(testStr))
want := 281
got := calculateSumCalibrationValues(buf)
if want != got {
t.Errorf("Unexpected value returned from calculateSumCalibrationValues(); want %d, got %d", want, got)
}
}