From 63a3351c9527f9f774862329b56f487339b09903 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sat, 5 Feb 2022 11:06:55 -0500 Subject: dbstore: refactor, separate cpesearchrow and cpesearchtype, add cpesearchtype_test --- dbstore/cpesearchtype_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 dbstore/cpesearchtype_test.go (limited to 'dbstore/cpesearchtype_test.go') diff --git a/dbstore/cpesearchtype_test.go b/dbstore/cpesearchtype_test.go new file mode 100644 index 0000000..1421d3c --- /dev/null +++ b/dbstore/cpesearchtype_test.go @@ -0,0 +1,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) + } + }) + } +} -- cgit v1.2.3