aboutsummaryrefslogtreecommitdiff
path: root/cvss/severity_test.go
blob: 41fff066b33df7bdadbb094234cda80eb66162f0 (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
25
26
27
package cvss

import "testing"

func TestSeverityString(t *testing.T) {
  tests := []struct {
    val Severity
    exp string
  } {
    { None, "None" },
    { Low, "Low" },
    { Medium, "Medium" },
    { High, "High" },
    { Critical, "Critical" },
    { Unknown, "Unknown" },
    { Severity(255), "Severity(255)" },
  }

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