mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-05 17:05:32 +08:00
25 lines
493 B
Go
25 lines
493 B
Go
package version
|
|
|
|
import "testing"
|
|
|
|
func TestNormalizeAndTag(t *testing.T) {
|
|
if got := normalize("v2.3.5"); got != "2.3.5" {
|
|
t.Fatalf("normalize failed: %q", got)
|
|
}
|
|
if got := Tag("2.3.5"); got != "v2.3.5" {
|
|
t.Fatalf("tag failed: %q", got)
|
|
}
|
|
}
|
|
|
|
func TestCompare(t *testing.T) {
|
|
if Compare("2.3.5", "2.3.5") != 0 {
|
|
t.Fatal("expected equal")
|
|
}
|
|
if Compare("2.3.5", "2.3.6") >= 0 {
|
|
t.Fatal("expected less")
|
|
}
|
|
if Compare("v2.10.0", "2.3.9") <= 0 {
|
|
t.Fatal("expected greater")
|
|
}
|
|
}
|