diff options
author | Paul Duncan <pabs@pablotron.org> | 2022-02-07 11:03:09 -0500 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2022-02-07 11:03:09 -0500 |
commit | 19bcc5e8df039f5de0f46fd6aa71e425a5e797bb (patch) | |
tree | d931dc7b113cd2f989d0afdde9adfa00e6aca3ba /cvss/severity_string.go | |
parent | 5bc6072dd22038f8f0c3cf6cc8ed758293725a8f (diff) | |
download | cvez-19bcc5e8df039f5de0f46fd6aa71e425a5e797bb.tar.bz2 cvez-19bcc5e8df039f5de0f46fd6aa71e425a5e797bb.zip |
cvss: add severity and tests
Diffstat (limited to 'cvss/severity_string.go')
-rw-r--r-- | cvss/severity_string.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/cvss/severity_string.go b/cvss/severity_string.go new file mode 100644 index 0000000..8155fa2 --- /dev/null +++ b/cvss/severity_string.go @@ -0,0 +1,27 @@ +// Code generated by "stringer -linecomment -type=Severity"; DO NOT EDIT. + +package cvss + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[None-0] + _ = x[Low-1] + _ = x[Medium-2] + _ = x[High-3] + _ = x[Critical-4] +} + +const _Severity_name = "NoneLowMediumHighCritical" + +var _Severity_index = [...]uint8{0, 4, 7, 13, 17, 25} + +func (i Severity) String() string { + if i >= Severity(len(_Severity_index)-1) { + return "Severity(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _Severity_name[_Severity_index[i]:_Severity_index[i+1]] +} |