forked from LeoYoung-code/utils
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparam_test.go
More file actions
54 lines (51 loc) · 823 Bytes
/
param_test.go
File metadata and controls
54 lines (51 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package utils
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func TestGetSysVersion(t *testing.T) {
type args struct {
versionStr string
}
tests := []struct {
name string
args args
want int64
}{
{
name: "test1",
args: args{
versionStr: "10.2",
},
want: 10,
},
{
name: "test2",
args: args{
versionStr: "10.10.5",
},
want: 10,
},
{
name: "test3",
args: args{
versionStr: "",
},
want: 0,
},
{
name: "test4",
args: args{
versionStr: "https://gopherize.me/goph",
},
want: 10,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
fmt.Println(GetSysVersion(tt.args.versionStr))
assert.Equalf(t, tt.want, GetSysVersion(tt.args.versionStr), "GetSysVersion(%v)", tt.args.versionStr)
})
}
}