country-geo-locations/pkg/geoloc/static_test.go

29 lines
551 B
Go
Raw Normal View History

2024-11-26 13:35:54 +01:00
package geoloc_test
import (
"reflect"
"testing"
2024-11-26 13:35:54 +01:00
"git.ar21.de/yolokube/country-geo-locations/pkg/geoloc"
)
2023-12-19 13:56:03 +01:00
func TestGetIPInfo(t *testing.T) {
type args struct {
input string
}
tests := []struct {
name string
args args
want uint
}{
{"IP address Test", args{input: "1.1.1.1"}, 16843008},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
2024-11-26 13:35:54 +01:00
if got, err := geoloc.CalculateIPNum(tt.args.input); err != nil || !reflect.DeepEqual(got, tt.want) {
2023-12-19 13:56:03 +01:00
t.Errorf("GetIPInfo() - %v, want %v", got, tt.want)
}
})
}
}