8#include <cgreen/cgreen.h>
9#include <cgreen/mocks.h>
23 assert_that (
nvti_new (), is_not_null);
31 gchar *solution_method;
37 assert_that (solution_method, is_equal_to_string (
"DebianAPTUpgrade"));
53 assert_that (tag, is_equal_to_string (
"1"));
68 assert_that (tag, is_equal_to_string (
"2"));
141 is_equal_to_string (
"ABC"));
154 is_equal_to_string (
"ABC"));
167 is_equal_to_string (
"DEF"));
179 suite = create_test_suite ();
181 add_test_with_context (suite,
nvti, nvti_new_never_returns_null);
183 add_test_with_context (suite,
nvti, nvti_get_tag_gets_correct_value_one_tag);
184 add_test_with_context (suite,
nvti,
185 nvti_get_tag_gets_correct_value_many_tags);
186 add_test_with_context (suite,
nvti, nvti_get_tag_handles_empty_tag);
187 add_test_with_context (suite,
nvti, nvti_get_tag_handles_null_nvti);
188 add_test_with_context (suite,
nvti, nvti_get_tag_handles_null_name);
190 add_test_with_context (suite,
nvti, nvti_set_solution_method_correct);
192 add_test_with_context (suite,
nvti, nvtis_add_does_not_use_oid_as_key);
194 add_test_with_context (suite,
nvti, nvti_get_severity_vector_both);
195 add_test_with_context (suite,
nvti,
196 nvti_get_severity_vector_no_severity_vector);
197 add_test_with_context (suite,
nvti, nvti_get_severity_vector_no_cvss_base);
200 return run_single_test (suite, argv[1], create_text_reporter ());
202 return run_test_suite (suite, create_text_reporter ());
Implementation of API to handle NVT Info datasets.
nvti_t * nvti_new(void)
Create a new (empty) nvti structure.
gchar * nvti_get_tag(const nvti_t *n, const gchar *name)
Get a tag value by a tag name.
nvtis_t * nvtis_new(void)
Make a collection of NVT Infos.
int nvti_set_oid(nvti_t *n, const gchar *oid)
Set the OID of a NVT Info.
int nvti_set_tag(nvti_t *n, const gchar *tag)
Set the tags of a NVT.
gchar * nvti_severity_vector_from_tag(const nvti_t *n)
Get the severity score.
gchar * nvti_solution_method(const nvti_t *n)
Get the solution method.
gchar * nvti_oid(const nvti_t *n)
Get the OID string.
int nvti_set_solution_method(nvti_t *n, const gchar *solution_method)
Set the solution method of a NVT.
nvti_t * nvtis_lookup(nvtis_t *nvtis, const char *oid)
Add an NVT Info to a collection of NVT Infos.
void nvtis_add(nvtis_t *nvtis, nvti_t *nvti)
Add an NVT Info to a collection of NVT Infos.
void nvti_free(nvti_t *n)
Free memory of a nvti structure.
GHashTable nvtis_t
A collection of information records corresponding to NVTs.
Ensure(nvti, nvti_new_never_returns_null)
int main(int argc, char **argv)
The structure of a information record that corresponds to a NVT.