package cvss import ( "testing" ) func TestNewScores(t *testing.T) { // test out of bound errors failTests := []struct { name string // test name vals []float64 // invalid base, temporal, and env scores } {{ name: "invalid base", vals: []float64 { 11.0, 0.0, 0.0 }, }, { name: "invalid temporal", vals: []float64 { 0.0, 11.0, 0.0 }, }, { name: "invalid env", vals: []float64 { 0.0, 0.0, 11.0 }, }} for _, test := range(failTests) { t.Run(test.name, func(t *testing.T) { got, err := NewScores(test.vals[0], test.vals[1], test.vals[2]) if err == nil { t.Errorf("got %v, exp error", got) } }) } }