github.com/benoitkugler/goacve@v0.0.0-20201217100549-151ce6e55dc8/server/core/utils/versions_test.go (about) 1 package utils 2 3 import ( 4 "fmt" 5 "testing" 6 7 rd "github.com/benoitkugler/goACVE/server/core/rawdata" 8 ) 9 10 func TestRandom(t *testing.T) { 11 fmt.Println(rd.RandString(100, true)) 12 } 13 14 func TestVersions(t *testing.T) { 15 if !IsNewer("2.3", "3.5.10") { 16 t.Fail() 17 } 18 if IsNewer("4.8", "3.5.10") { 19 t.Fail() 20 } 21 if !IsNewer("2.3", "2.3.10") { 22 t.Fail() 23 } 24 if IsNewer("2.3.5", "2.3") { 25 t.Fail() 26 } 27 if IsNewer("2.3", "2.3") { 28 t.Fail() 29 } 30 if IsNewer("2.3", "2.3.0") { 31 t.Fail() 32 } 33 if IsNewer("2", "1") { 34 t.Fail() 35 } 36 } 37 38 func TestSlice(t *testing.T) { 39 slice := []int{1, 2, 3, 4, 5} 40 s := 3 41 fmt.Println(append(slice[:s], slice[s+1:]...)) 42 }