package main import ( "testing" ) var example = `v...>>.vv> .vv>>.vv.. >>.>v>...v >>v>>.>.v. v>v.vv.v.. >.>>..v... .vv..>.>v. v.v..>>v.v ....v..v.>` var doneExample = `..>>v>vv.. ..v.>>vv.. ..>>v>>vv. ..>>>>>vv. v......>vv v>v....>>v vvv.....>> >vv......> .>v.vv.v..` func Test_part1(t *testing.T) { tests := []struct { name string input string want int }{ { name: "example", input: example, want: 58, }, { name: "doneExample", input: doneExample, want: 1, }, { name: "actual", input: input, want: 579, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := part1(tt.input); got != tt.want { t.Errorf("part1() = %v, want %v", got, tt.want) } }) } }