|
|
package utils
|
|
|
|
|
|
import "testing"
|
|
|
import (
|
|
|
"fmt"
|
|
|
"testing"
|
|
|
)
|
|
|
|
|
|
func Test_DeepCopy(t *testing.T) {
|
|
|
type User1 struct {
|
...
|
...
|
@@ -23,3 +26,27 @@ func Test_DeepCopy(t *testing.T) { |
|
|
}
|
|
|
//t.Log(src,"\n",dst)
|
|
|
}
|
|
|
|
|
|
func TestValidVersion(t *testing.T) {
|
|
|
inputs := []struct {
|
|
|
In string
|
|
|
Compare string
|
|
|
Out bool
|
|
|
}{
|
|
|
{In: "0.9.0", Compare: "0.8.0", Out: true},
|
|
|
{In: "0.8.11", Compare: "0.8.0", Out: true},
|
|
|
{In: "0.7.0", Compare: "0.8.0", Out: false},
|
|
|
{In: "0.8.0", Compare: "0.8.0", Out: true},
|
|
|
{In: "0.9", Compare: "0.8.0", Out: true},
|
|
|
{In: "0.10", Compare: "0.8.0", Out: true},
|
|
|
{In: "1.8.0", Compare: "0.8.0", Out: true},
|
|
|
{In: "0.99.0", Compare: "0.8.0", Out: true},
|
|
|
{In: "01.0.0", Compare: "0.8.0", Out: true},
|
|
|
}
|
|
|
for i := range inputs {
|
|
|
input := inputs[i]
|
|
|
if ValidVersion(input.In, input.Compare) != input.Out {
|
|
|
t.Fatal(fmt.Sprintf("valid version fail. input :%v compare:%v want:%v", input.In, input.Compare, input.Out))
|
|
|
}
|
|
|
}
|
|
|
} |
...
|
...
|
|