test: cover builtin types
This commit is contained in:
parent
461c17299e
commit
f17622195a
|
@ -2,11 +2,24 @@ package validator_test
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/xdrm-io/aicra/validator"
|
||||
)
|
||||
|
||||
func TestAny_ReflectType(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var (
|
||||
dt = validator.AnyType{}
|
||||
expected = reflect.TypeOf(interface{}(nil))
|
||||
)
|
||||
if dt.GoType() != expected {
|
||||
t.Fatalf("invalid GoType() %v ; expected %v", dt.GoType(), expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAny_AvailableTypes(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
@ -2,11 +2,24 @@ package validator_test
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/xdrm-io/aicra/validator"
|
||||
)
|
||||
|
||||
func TestBool_ReflectType(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var (
|
||||
dt = validator.BoolType{}
|
||||
expected = reflect.TypeOf(true)
|
||||
)
|
||||
if dt.GoType() != expected {
|
||||
t.Fatalf("invalid GoType() %v ; expected %v", dt.GoType(), expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBool_AvailableTypes(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
@ -3,11 +3,24 @@ package validator_test
|
|||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/xdrm-io/aicra/validator"
|
||||
)
|
||||
|
||||
func TestFloat64_ReflectType(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var (
|
||||
dt = validator.FloatType{}
|
||||
expected = reflect.TypeOf(float64(0.0))
|
||||
)
|
||||
if dt.GoType() != expected {
|
||||
t.Fatalf("invalid GoType() %v ; expected %v", dt.GoType(), expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFloat64_AvailableTypes(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
@ -3,11 +3,24 @@ package validator_test
|
|||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/xdrm-io/aicra/validator"
|
||||
)
|
||||
|
||||
func TestInt_ReflectType(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var (
|
||||
dt = validator.IntType{}
|
||||
expected = reflect.TypeOf(int(0))
|
||||
)
|
||||
if dt.GoType() != expected {
|
||||
t.Fatalf("invalid GoType() %v ; expected %v", dt.GoType(), expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestInt_AvailableTypes(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
@ -2,11 +2,24 @@ package validator_test
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/xdrm-io/aicra/validator"
|
||||
)
|
||||
|
||||
func TestString_ReflectType(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var (
|
||||
dt = validator.StringType{}
|
||||
expected = reflect.TypeOf(string("abc"))
|
||||
)
|
||||
if dt.GoType() != expected {
|
||||
t.Fatalf("invalid GoType() %v ; expected %v", dt.GoType(), expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestString_AvailableTypes(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
@ -3,11 +3,24 @@ package validator_test
|
|||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/xdrm-io/aicra/validator"
|
||||
)
|
||||
|
||||
func TestUint_ReflectType(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var (
|
||||
dt = validator.UintType{}
|
||||
expected = reflect.TypeOf(uint(0))
|
||||
)
|
||||
if dt.GoType() != expected {
|
||||
t.Fatalf("invalid GoType() %v ; expected %v", dt.GoType(), expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUint_AvailableTypes(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
Loading…
Reference in New Issue