Files
2026-05-20 16:13:58 +08:00

82 lines
1.4 KiB
Go

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)
}
})
}
}