diff options
author | Paul Duncan <pabs@pablotron.org> | 2022-02-07 10:42:24 -0500 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2022-02-07 10:42:24 -0500 |
commit | 54a781b9beacdd9ec9c27909c7b315adccdf1ab6 (patch) | |
tree | 424270315ace22167b69763893cdce5a64ea921f | |
parent | 99bd0db9e2be1da3d3144bc5aedf23b9f7447e24 (diff) | |
download | cvez-54a781b9beacdd9ec9c27909c7b315adccdf1ab6.tar.bz2 cvez-54a781b9beacdd9ec9c27909c7b315adccdf1ab6.zip |
cvss: add tests for all metrics
-rw-r--r-- | cvss/v2scores_test.go | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/cvss/v2scores_test.go b/cvss/v2scores_test.go index cc54ba4..0d6ab87 100644 --- a/cvss/v2scores_test.go +++ b/cvss/v2scores_test.go @@ -73,6 +73,138 @@ func TestNewV2Scores(t *testing.T) { name: "CVE-2003-0062/all", // 3.3.3 val: "AV:L/AC:H/Au:N/C:C/I:C/A:C/E:POC/RL:OF/RC:C/CDP:H/TD:H/CR:M/IR:M/AR:M", exps: []float64 { 6.2, 4.9, 7.5 }, + }, { + name: "A:N", // from nvd v2 calc + val: "AV:A/AC:M/Au:M/C:P/I:P/A:N", + exps: []float64 { 3.4, 0.0, 0.0 }, + }, { + name: "Au:S", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P", + exps: []float64 { 4.9, 0.0, 0.0 }, + }, { + name: "E:ND", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:ND", + exps: []float64 { 4.9, 0.0, 0.0 }, + }, { + name: "E:U", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:U/RL:ND/RC:ND", + exps: []float64 { 4.9, 4.2, 0.0 }, + }, { + name: "E:H", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:ND/RC:ND", + exps: []float64 { 4.9, 4.9, 0.0 }, + }, { + name: "RL:TF", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:TF/RC:ND", + exps: []float64 { 4.9, 4.4, 0.0 }, + }, { + name: "RL:W", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND", + exps: []float64 { 4.9, 4.7, 0.0 }, + }, { + name: "RL:U", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:U/RC:ND", + exps: []float64 { 4.9, 4.9, 0.0 }, + }, { + name: "RC:UC", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:U/RC:UC", + exps: []float64 { 4.9, 4.4, 0.0 }, + }, { + name: "RC:UR", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:U/RC:UR", + exps: []float64 { 4.9, 4.7, 0.0 }, + }, { + name: "CDP:ND", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:ND/TD:H/CR:L/IR:L/AR:L", + exps: []float64 { 4.9, 4.7, 2.8 }, + }, { + name: "CDP:N", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:N/TD:H/CR:L/IR:L/AR:L", + exps: []float64 { 4.9, 4.7, 2.8 }, + }, { + name: "CDP:L", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:L/TD:H/CR:L/IR:L/AR:L", + exps: []float64 { 4.9, 4.7, 3.5 }, + }, { + name: "CDP:LM", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:LM/TD:H/CR:L/IR:L/AR:L", + exps: []float64 { 4.9, 4.7, 5.0 }, + }, { + name: "CDP:MH", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:MH/TD:H/CR:L/IR:L/AR:L", + exps: []float64 { 4.9, 4.7, 5.7 }, + }, { + name: "CDP:H", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:H/TD:H/CR:L/IR:L/AR:L", + exps: []float64 { 4.9, 4.7, 6.4 }, + }, { + name: "TD:ND", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:H/TD:ND/CR:L/IR:L/AR:L", + exps: []float64 { 4.9, 4.7, 6.4 }, + }, { + name: "TD:N", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:H/TD:N/CR:L/IR:L/AR:L", + exps: []float64 { 4.9, 4.7, 0.0 }, + }, { + name: "TD:L", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:H/TD:L/CR:L/IR:L/AR:L", + exps: []float64 { 4.9, 4.7, 1.6 }, + }, { + name: "TD:M", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:H/TD:M/CR:L/IR:L/AR:L", + exps: []float64 { 4.9, 4.7, 4.8 }, + }, { + name: "TD:H", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:H/TD:H/CR:L/IR:L/AR:L", + exps: []float64 { 4.9, 4.7, 6.4 }, + }, { + name: "CR:ND", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:H/TD:H/CR:ND/IR:L/AR:L", + exps: []float64 { 4.9, 4.7, 6.8 }, + }, { + name: "CR:L", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:H/TD:H/CR:L/IR:L/AR:L", + exps: []float64 { 4.9, 4.7, 6.4 }, + }, { + name: "CR:M", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:H/TD:H/CR:M/IR:L/AR:L", + exps: []float64 { 4.9, 4.7, 6.8 }, + }, { + name: "CR:H", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:H/TD:H/CR:H/IR:L/AR:L", + exps: []float64 { 4.9, 4.7, 7.1 }, + }, { + name: "IR:ND", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:H/TD:H/CR:L/IR:ND/AR:L", + exps: []float64 { 4.9, 4.7, 6.8 }, + }, { + name: "IR:L", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:H/TD:H/CR:L/IR:L/AR:L", + exps: []float64 { 4.9, 4.7, 6.4 }, + }, { + name: "IR:M", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:H/TD:H/CR:L/IR:M/AR:L", + exps: []float64 { 4.9, 4.7, 6.8 }, + }, { + name: "IR:H", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:H/TD:H/CR:L/IR:H/AR:L", + exps: []float64 { 4.9, 4.7, 7.1 }, + }, { + name: "AR:ND", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:H/TD:H/CR:L/IR:L/AR:ND", + exps: []float64 { 4.9, 4.7, 6.8 }, + }, { + name: "AR:L", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:H/TD:H/CR:L/IR:L/AR:L", + exps: []float64 { 4.9, 4.7, 6.4 }, + }, { + name: "AR:M", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:H/TD:H/CR:L/IR:L/AR:M", + exps: []float64 { 4.9, 4.7, 6.8 }, + }, { + name: "AR:H", // from nvd v2 calc + val: "AV:A/AC:M/Au:S/C:P/I:P/A:P/E:H/RL:W/RC:ND/CDP:H/TD:H/CR:L/IR:L/AR:H", + exps: []float64 { 4.9, 4.7, 7.1 }, }} // TODO: add additional test vectors using v2 calc |