Skip to content

Commit

Permalink
Added a test for input.ToIntegers
Browse files Browse the repository at this point in the history
  • Loading branch information
gdejong committed Dec 5, 2024
1 parent 623a016 commit 6ef1e6a
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions internal/input/input_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package input

import (
"reflect"
"testing"
)

func TestToIntegers(t *testing.T) {
var tests = []struct {
name string
in []string
want []int
}{
{
name: "empty case",
in: []string{},
want: []int{},
},
{
name: "single case",
in: []string{"0"},
want: []int{0},
},
{
name: "multiple case",
in: []string{"0", "1", "2"},
want: []int{0, 1, 2},
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := ToIntegers(tt.in)
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("got %q, wanted %q", got, tt.want)
}
})
}
}

0 comments on commit 6ef1e6a

Please sign in to comment.