aboutsummaryrefslogtreecommitdiff
path: root/cvss/category_test.go
blob: 7f69689de9cb08fae540acba926d4b37ebc76325 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package cvss

import "testing"

func TestCategoryString(t *testing.T) {
  tests := []struct {
    cat Category
    exp string
  } {
    { Base, "Base" },
    { Temporal, "Temporal" },
    { Environmental, "Environmental" },
  }

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

func TestInvalidCategory(t *testing.T) {
  tests := []struct {
    cat Category
    exp string
  } {
    { Category(byte(255)), "Category(255)" },
  }

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