aboutsummaryrefslogtreecommitdiff
path: root/cvss/version_test.go
blob: e010094b1dd7f20835d3ae157f3f51c3a23c6601 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package cvss

import "testing"

func TestVersionString(t *testing.T) {
  tests := []struct {
    val Version
    exp string
  } {
    { V20, "2.0" },
    { V30, "3.0" },
    { V31, "3.1" },
    { Version(255), "Version(255)" },
  }

  for _, test := range(tests) {
    t.Run(test.val.String(), func(t *testing.T) {
      got := test.val.String()
      if got != test.exp {
        t.Errorf("got: \"%s\", exp: \"%s\"", got, test.exp)
      }
    })
  }
}