mirror of
https://github.com/yanislav-igonin/micrach
synced 2026-07-27 05:14:17 +03:00
27 lines
532 B
Go
27 lines
532 B
Go
|
|
package repositories
|
||
|
|
|
||
|
|
import (
|
||
|
|
"reflect"
|
||
|
|
"testing"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestToInt32s(t *testing.T) {
|
||
|
|
tests := []struct {
|
||
|
|
name string
|
||
|
|
in []int
|
||
|
|
want []int32
|
||
|
|
}{
|
||
|
|
{name: "nil", in: nil, want: nil},
|
||
|
|
{name: "empty", in: []int{}, want: []int32{}},
|
||
|
|
{name: "values", in: []int{1, 2, 2147483647}, want: []int32{1, 2, 2147483647}},
|
||
|
|
}
|
||
|
|
|
||
|
|
for _, tt := range tests {
|
||
|
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
|
if got := toInt32s(tt.in); !reflect.DeepEqual(got, tt.want) {
|
||
|
|
t.Fatalf("toInt32s() = %#v, want %#v", got, tt.want)
|
||
|
|
}
|
||
|
|
})
|
||
|
|
}
|
||
|
|
}
|