more test cases

This commit is contained in:
Pavel Merzlyakov 2022-10-01 18:41:06 +03:00
parent 749af4bbe8
commit 80158cece8
1 changed files with 18 additions and 0 deletions

View File

@ -51,6 +51,24 @@ func TestParse(t *testing.T) {
{versionStr: "12345", valid: true, expectedStr: "12345.0.0", expectedCode: 1234500000}, {versionStr: "12345", valid: true, expectedStr: "12345.0.0", expectedCode: 1234500000},
{versionStr: "42948", valid: true, expectedStr: "42948.0.0", expectedCode: 4294800000}, {versionStr: "42948", valid: true, expectedStr: "42948.0.0", expectedCode: 4294800000},
{versionStr: "42949", valid: false}, {versionStr: "42949", valid: false},
{versionStr: "1 ", valid: false},
{versionStr: " 1", valid: false},
{versionStr: "a1", valid: false},
{versionStr: "1a", valid: false},
{versionStr: "1.1 ", valid: false},
{versionStr: "1. 1", valid: false},
{versionStr: "1.1a", valid: false},
{versionStr: "1.a1", valid: false},
{versionStr: "1.1.1 ", valid: false},
{versionStr: "1.1. 1", valid: false},
{versionStr: "1.1.1a", valid: false},
{versionStr: "1.1.a1", valid: false},
{versionStr: "1,1.1", valid: false},
{versionStr: "1!1.1", valid: false},
{versionStr: "1 1.1", valid: false},
} }
for i, c := range cases { for i, c := range cases {