aboutsummaryrefslogtreecommitdiff
path: root/internal/cvss/v3key_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/cvss/v3key_test.go')
-rw-r--r--internal/cvss/v3key_test.go142
1 files changed, 0 insertions, 142 deletions
diff --git a/internal/cvss/v3key_test.go b/internal/cvss/v3key_test.go
deleted file mode 100644
index 517eebd..0000000
--- a/internal/cvss/v3key_test.go
+++ /dev/null
@@ -1,142 +0,0 @@
-package cvss
-
-import (
- "testing"
-)
-
-func TestV3KeyString(t *testing.T) {
- tests := []struct {
- val v3Key
- exp string
- } {
- { v3AttackVector, "AV" },
- { v3AttackComplexity, "AC" },
- { v3PrivilegesRequired, "PR" },
- { v3UserInteraction, "UI" },
- { v3Scope, "S" },
- { v3Confidentiality, "C" },
- { v3Integrity, "I" },
- { v3Availability, "A" },
- { v3ExploitCodeMaturity, "E" },
- { v3RemediationLevel, "RL" },
- { v3ReportConfidence, "RC" },
- { v3ConfidentialityRequirement, "CR" },
- { v3IntegrityRequirement, "IR" },
- { v3AvailabilityRequirement, "AR" },
- { v3ModifiedAttackVector, "MAV" },
- { v3ModifiedAttackComplexity, "MAC" },
- { v3ModifiedPrivilegesRequired, "MPR" },
- { v3ModifiedUserInteraction, "MUI" },
- { v3ModifiedScope, "MS" },
- { v3ModifiedConfidentiality, "MC" },
- { v3ModifiedIntegrity, "MI" },
- { v3ModifiedAvailability, "MA" },
-
- { v3Key(255), "v3Key(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)
- }
- })
- }
-}
-
-func TestV3KeyName(t *testing.T) {
- tests := []struct {
- val v3Key
- exp string
- } {
- { v3AttackVector, "Attack Vector" },
- { v3AttackComplexity, "Attack Complexity" },
- { v3PrivilegesRequired, "Privileges Required" },
- { v3UserInteraction, "User Interaction" },
- { v3Scope, "Scope" },
- { v3Confidentiality, "Confidentiality" },
- { v3Integrity, "Integrity" },
- { v3Availability, "Availability" },
- { v3ExploitCodeMaturity, "Exploit Code Maturity" },
- { v3RemediationLevel, "Remediation Level" },
- { v3ReportConfidence, "Report Confidence" },
- { v3ConfidentialityRequirement, "Confidentiality Requirement" },
- { v3IntegrityRequirement, "Integrity Requirement" },
- { v3AvailabilityRequirement, "Availability Requirement" },
- { v3ModifiedAttackVector, "Modified Attack Vector" },
- { v3ModifiedAttackComplexity, "Modified Attack Complexity" },
- { v3ModifiedPrivilegesRequired, "Modified Privileges Required" },
- { v3ModifiedUserInteraction, "Modified User Interaction" },
- { v3ModifiedScope, "Modified Scope" },
- { v3ModifiedConfidentiality, "Modified Confidentiality" },
- { v3ModifiedIntegrity, "Modified Integrity" },
- { v3ModifiedAvailability, "Modified Availability" },
- }
-
- for _, test := range(tests) {
- t.Run(test.exp, func(t *testing.T) {
- got := test.val.Name()
- if got != test.exp {
- t.Errorf("got \"%s\", exp \"%s\"", got, test.exp)
- }
- })
- }
-}
-
-func TestV3KeyCategory(t *testing.T) {
- tests := []struct {
- val v3Key
- exp Category
- } {
- { v3AttackVector, Base },
- { v3AttackComplexity, Base },
- { v3PrivilegesRequired, Base },
- { v3UserInteraction, Base },
- { v3Scope, Base },
- { v3Confidentiality, Base },
- { v3Integrity, Base },
- { v3Availability, Base },
- { v3ExploitCodeMaturity, Temporal },
- { v3RemediationLevel, Temporal },
- { v3ReportConfidence, Temporal },
- { v3ConfidentialityRequirement, Environmental },
- { v3IntegrityRequirement, Environmental },
- { v3AvailabilityRequirement, Environmental },
- { v3ModifiedAttackVector, Environmental },
- { v3ModifiedAttackComplexity, Environmental },
- { v3ModifiedPrivilegesRequired, Environmental },
- { v3ModifiedUserInteraction, Environmental },
- { v3ModifiedScope, Environmental },
- { v3ModifiedConfidentiality, Environmental },
- { v3ModifiedIntegrity, Environmental },
- { v3ModifiedAvailability, Environmental },
- }
-
- for _, test := range(tests) {
- t.Run(test.val.String(), func(t *testing.T) {
- got := test.val.Category()
- if got != test.exp {
- t.Errorf("got \"%s\", exp \"%s\"", got, test.exp)
- }
- })
- }
-}
-
-func TestInvalidV3KeyName(t *testing.T) {
- exp := "invalid"
- got := v3Key(255).Name()
-
- if got != exp {
- t.Errorf("got: \"%s\", exp: \"%s\"", got, exp)
- }
-}
-
-func TestInvalidV3KeyCategory(t *testing.T) {
- exp := InvalidCategory
- got := v3Key(255).Category()
-
- if got != exp {
- t.Errorf("got: \"%s\", exp: \"%s\"", got, exp)
- }
-}