Initial commit
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
package statutils
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestIsDeviceH5(t *testing.T) {
|
||||
type args struct {
|
||||
devs []string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want bool
|
||||
}{
|
||||
{
|
||||
name: "a",
|
||||
args: args{
|
||||
devs: []string{"andro", "android", "h5_android"},
|
||||
},
|
||||
want: true,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := IsClientH5(tt.args.devs...); got != tt.want {
|
||||
t.Errorf("IsClientH5() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsDeviceAndroid(t *testing.T) {
|
||||
type args struct {
|
||||
devs []string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want bool
|
||||
}{
|
||||
{
|
||||
name: "a",
|
||||
args: args{
|
||||
devs: []string{"andro", "android", "h5_android1"},
|
||||
},
|
||||
want: true,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := IsClientAndroid(tt.args.devs...); got != tt.want {
|
||||
t.Errorf("IsClientH5() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsDeviceIos(t *testing.T) {
|
||||
type args struct {
|
||||
devs []string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want bool
|
||||
}{
|
||||
{
|
||||
name: "a",
|
||||
args: args{
|
||||
devs: []string{"ios", "android", "h5_android1"},
|
||||
},
|
||||
want: true,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := IsClientIos(tt.args.devs...); got != tt.want {
|
||||
t.Errorf("IsClientH5() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user