lc-go/solutions/1/q134/solution_test.go
2025-12-23 18:39:11 +09:00

34 lines
613 B
Go

package q134
import (
"testing"
)
func Test_canCompleteCircuit(t *testing.T) {
tests := []struct {
name string // description of this test case
// Named input parameters for target function.
gas []int
cost []int
want int
}{
{
gas: []int{1, 2, 3, 4, 5},
cost: []int{3, 4, 5, 1, 2},
want: 3,
},
{
gas: []int{2, 3, 4},
cost: []int{3, 4, 3},
want: -1,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := canCompleteCircuit(tt.gas, tt.cost)
if got != tt.want {
t.Errorf("canCompleteCircuit() = %v, want %v", got, tt.want)
}
})
}
}