-
Notifications
You must be signed in to change notification settings - Fork 3
/
versionscheme_test.go
58 lines (53 loc) · 1.11 KB
/
versionscheme_test.go
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
55
56
57
58
// Copyright 2020 Contributors to the Veraison project.
// SPDX-License-Identifier: Apache-2.0
package swid
import (
"errors"
"testing"
"github.com/stretchr/testify/assert"
)
func TestVersionScheme_Set(t *testing.T) {
tests := []struct {
name string
tv int64
expected error
}{
{
name: "known codepoints (1)",
tv: VersionSchemeMultipartNumeric,
expected: nil,
},
{
name: "known codepoints (2)",
tv: VersionSchemeMultipartNumericSuffix,
expected: nil,
},
{
name: "known codepoints (3)",
tv: VersionSchemeAlphaNumeric,
expected: nil,
},
{
name: "known codepoints (4)",
tv: VersionSchemeDecimal,
expected: nil,
},
{
name: "known codepoints (5)",
tv: VersionSchemeSemVer,
expected: nil,
},
{
name: "unknown codepoint",
tv: 19283937,
expected: errors.New("unknown version scheme 19283937"),
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
var u VersionScheme
actual := u.SetCode(test.tv)
assert.Equal(t, test.expected, actual)
})
}
}