aboutsummaryrefslogtreecommitdiff
path: root/dbstore/cpesearchtype_test.go
blob: 255b311bb963039cad8c54d640ea945debf7cf3b (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 dbstore

import "testing"

func TestCpeSearchTypeString(t *testing.T) {
  tests := []struct {
    val CpeSearchType
    exp string
  } {
    { CpeSearchAll, "cpe/search-all" },
    { CpeSearchTitle, "cpe/search-title" },
    { CpeSearchRef, "cpe/search-ref" },
    { CpeSearchType(255), "CpeSearchType(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)
      }
    })
  }
}