|
Greenbone Vulnerability Management Libraries 22.32.0
|
#include "streamvalidator.h"#include <assert.h>#include <cgreen/cgreen.h>#include <cgreen/mocks.h>
Go to the source code of this file.
Macros | |
| #define | VALID_DATA "This should be valid...." |
| #define | TOO_SHORT_DATA "This is too short!" |
| #define | TOO_LONG_DATA "This text is longer than expected!" |
| #define | INVALID_DATA "This shouldn't be valid!" |
| #define | VALID_DATA_HASH "sha256:4ae8f10c9e9551173520b7a675e9caba163007edf04dbbd06022bf61ad3fe4fb" |
Functions | |
| Describe (streamvalidator) | |
| BeforeEach (streamvalidator) | |
| AfterEach (streamvalidator) | |
| Ensure (streamvalidator, accepts_valid_data) | |
| Ensure (streamvalidator, accepts_valid_data_after_multiple_writes) | |
| Ensure (streamvalidator, accepts_valid_data_after_rewind) | |
| Ensure (streamvalidator, rejects_too_long_data) | |
| Ensure (streamvalidator, rejects_too_short_data) | |
| Ensure (streamvalidator, rejects_hash_mismatch) | |
| Ensure (streamvalidator, init_rejects_empty_hash) | |
| Ensure (streamvalidator, init_rejects_invalid_syntax_hashes) | |
| Ensure (streamvalidator, init_rejects_invalid_algo_hashes) | |
| Ensure (streamvalidator, init_rejects_invalid_value_hashes) | |
| Ensure (streamvalidator, accepts_valid_checksum_only_without_size) | |
| Ensure (streamvalidator, rejects_checksum_with_extra_colon_suffix_as_invalid_hex) | |
| Ensure (streamvalidator, enforces_size_from_arg_when_no_suffix) | |
| Ensure (streamvalidator, checksum_only_extra_bytes_yield_hash_mismatch) | |
| Ensure (streamvalidator, init_rejects_invalid_syntax_algo_and_value) | |
| Ensure (streamvalidator, return_str_ok_is_null) | |
| Ensure (streamvalidator, return_str_maps_known_codes) | |
| Ensure (streamvalidator, return_str_unknown_code_yields_unknown_error) | |
| Ensure (streamvalidator, wrapper_checksum_only_accepts_valid_data) | |
| Ensure (streamvalidator, wrapper_checksum_only_does_not_enforce_size) | |
| Ensure (streamvalidator, wrapper_rejects_invalid_hash_syntax) | |
| int | main (int argc, char **argv) |
| #define INVALID_DATA "This shouldn't be valid!" |
Definition at line 15 of file streamvalidator_tests.c.
Referenced by Ensure().
| #define TOO_LONG_DATA "This text is longer than expected!" |
| #define TOO_SHORT_DATA "This is too short!" |
Definition at line 13 of file streamvalidator_tests.c.
| #define VALID_DATA "This should be valid...." |
| #define VALID_DATA_HASH "sha256:4ae8f10c9e9551173520b7a675e9caba163007edf04dbbd06022bf61ad3fe4fb" |
Definition at line 16 of file streamvalidator_tests.c.
Referenced by Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), and Ensure().
| AfterEach | ( | streamvalidator | ) |
Definition at line 23 of file streamvalidator_tests.c.
| BeforeEach | ( | streamvalidator | ) |
Definition at line 20 of file streamvalidator_tests.c.
| Describe | ( | streamvalidator | ) |
| Ensure | ( | streamvalidator | , |
| accepts_valid_checksum_only_without_size | ) |
Definition at line 188 of file streamvalidator_tests.c.
References gvm_stream_validator_end(), gvm_stream_validator_free(), GVM_STREAM_VALIDATOR_NO_SIZE, GVM_STREAM_VALIDATOR_OK, gvm_stream_validator_with_size_new(), gvm_stream_validator_write(), VALID_DATA, and VALID_DATA_HASH.

| Ensure | ( | streamvalidator | , |
| accepts_valid_data | ) |
Definition at line 27 of file streamvalidator_tests.c.
References gvm_stream_validator_end(), gvm_stream_validator_free(), GVM_STREAM_VALIDATOR_OK, gvm_stream_validator_with_size_new(), gvm_stream_validator_write(), VALID_DATA, and VALID_DATA_HASH.

| Ensure | ( | streamvalidator | , |
| accepts_valid_data_after_multiple_writes | ) |
Definition at line 42 of file streamvalidator_tests.c.
References gvm_stream_validator_end(), gvm_stream_validator_free(), GVM_STREAM_VALIDATOR_OK, gvm_stream_validator_with_size_new(), gvm_stream_validator_write(), VALID_DATA, and VALID_DATA_HASH.

| Ensure | ( | streamvalidator | , |
| accepts_valid_data_after_rewind | ) |
Definition at line 61 of file streamvalidator_tests.c.
References gvm_stream_validator_end(), gvm_stream_validator_free(), GVM_STREAM_VALIDATOR_OK, gvm_stream_validator_rewind(), gvm_stream_validator_with_size_new(), gvm_stream_validator_write(), TOO_SHORT_DATA, VALID_DATA, and VALID_DATA_HASH.

| Ensure | ( | streamvalidator | , |
| checksum_only_extra_bytes_yield_hash_mismatch | ) |
Definition at line 257 of file streamvalidator_tests.c.
References gvm_stream_validator_end(), gvm_stream_validator_free(), GVM_STREAM_VALIDATOR_HASH_MISMATCH, GVM_STREAM_VALIDATOR_NO_SIZE, GVM_STREAM_VALIDATOR_OK, gvm_stream_validator_with_size_new(), gvm_stream_validator_write(), TOO_LONG_DATA, and VALID_DATA_HASH.

| Ensure | ( | streamvalidator | , |
| enforces_size_from_arg_when_no_suffix | ) |
Definition at line 223 of file streamvalidator_tests.c.
References GVM_STREAM_VALIDATOR_DATA_TOO_LONG, GVM_STREAM_VALIDATOR_DATA_TOO_SHORT, gvm_stream_validator_end(), gvm_stream_validator_free(), GVM_STREAM_VALIDATOR_OK, gvm_stream_validator_with_size_new(), gvm_stream_validator_write(), TOO_LONG_DATA, VALID_DATA, and VALID_DATA_HASH.

| Ensure | ( | streamvalidator | , |
| init_rejects_empty_hash | ) |
Definition at line 128 of file streamvalidator_tests.c.
References GVM_STREAM_VALIDATOR_INVALID_HASH_SYNTAX, and gvm_stream_validator_with_size_new().

| Ensure | ( | streamvalidator | , |
| init_rejects_invalid_algo_hashes | ) |
Definition at line 150 of file streamvalidator_tests.c.
References GVM_STREAM_VALIDATOR_INVALID_HASH_ALGORITHM, and gvm_stream_validator_with_size_new().

| Ensure | ( | streamvalidator | , |
| init_rejects_invalid_syntax_algo_and_value | ) |
Definition at line 275 of file streamvalidator_tests.c.
References GVM_STREAM_VALIDATOR_INVALID_HASH_ALGORITHM, GVM_STREAM_VALIDATOR_INVALID_HASH_SYNTAX, GVM_STREAM_VALIDATOR_INVALID_HASH_VALUE, GVM_STREAM_VALIDATOR_NO_SIZE, gvm_stream_validator_with_size_new(), and VALID_DATA_HASH.

| Ensure | ( | streamvalidator | , |
| init_rejects_invalid_syntax_hashes | ) |
Definition at line 137 of file streamvalidator_tests.c.
References GVM_STREAM_VALIDATOR_INVALID_HASH_SYNTAX, and gvm_stream_validator_with_size_new().

| Ensure | ( | streamvalidator | , |
| init_rejects_invalid_value_hashes | ) |
Definition at line 164 of file streamvalidator_tests.c.
References GVM_STREAM_VALIDATOR_INVALID_HASH_VALUE, and gvm_stream_validator_with_size_new().

| Ensure | ( | streamvalidator | , |
| rejects_checksum_with_extra_colon_suffix_as_invalid_hex | ) |
Definition at line 205 of file streamvalidator_tests.c.
References GVM_STREAM_VALIDATOR_INVALID_HASH_VALUE, GVM_STREAM_VALIDATOR_NO_SIZE, gvm_stream_validator_with_size_new(), and VALID_DATA_HASH.

| Ensure | ( | streamvalidator | , |
| rejects_hash_mismatch | ) |
Definition at line 112 of file streamvalidator_tests.c.
References gvm_stream_validator_end(), gvm_stream_validator_free(), GVM_STREAM_VALIDATOR_HASH_MISMATCH, GVM_STREAM_VALIDATOR_OK, gvm_stream_validator_with_size_new(), gvm_stream_validator_write(), INVALID_DATA, VALID_DATA, and VALID_DATA_HASH.

| Ensure | ( | streamvalidator | , |
| rejects_too_long_data | ) |
Definition at line 80 of file streamvalidator_tests.c.
References GVM_STREAM_VALIDATOR_DATA_TOO_LONG, gvm_stream_validator_end(), gvm_stream_validator_free(), GVM_STREAM_VALIDATOR_OK, gvm_stream_validator_with_size_new(), gvm_stream_validator_write(), TOO_LONG_DATA, VALID_DATA, and VALID_DATA_HASH.

| Ensure | ( | streamvalidator | , |
| rejects_too_short_data | ) |
Definition at line 96 of file streamvalidator_tests.c.
References GVM_STREAM_VALIDATOR_DATA_TOO_SHORT, gvm_stream_validator_end(), gvm_stream_validator_free(), GVM_STREAM_VALIDATOR_OK, gvm_stream_validator_with_size_new(), gvm_stream_validator_write(), TOO_SHORT_DATA, VALID_DATA, and VALID_DATA_HASH.

| Ensure | ( | streamvalidator | , |
| return_str_maps_known_codes | ) |
Definition at line 328 of file streamvalidator_tests.c.
References GVM_STREAM_VALIDATOR_DATA_TOO_LONG, GVM_STREAM_VALIDATOR_DATA_TOO_SHORT, GVM_STREAM_VALIDATOR_HASH_MISMATCH, GVM_STREAM_VALIDATOR_INTERNAL_ERROR, GVM_STREAM_VALIDATOR_INVALID_HASH_ALGORITHM, GVM_STREAM_VALIDATOR_INVALID_HASH_SYNTAX, GVM_STREAM_VALIDATOR_INVALID_HASH_VALUE, and gvm_stream_validator_return_str().

| Ensure | ( | streamvalidator | , |
| return_str_ok_is_null | ) |
Definition at line 322 of file streamvalidator_tests.c.
References GVM_STREAM_VALIDATOR_OK, and gvm_stream_validator_return_str().

| Ensure | ( | streamvalidator | , |
| return_str_unknown_code_yields_unknown_error | ) |
Definition at line 359 of file streamvalidator_tests.c.
References gvm_stream_validator_return_str().

| Ensure | ( | streamvalidator | , |
| wrapper_checksum_only_accepts_valid_data | ) |
Definition at line 366 of file streamvalidator_tests.c.
References gvm_stream_validator_end(), gvm_stream_validator_free(), gvm_stream_validator_new(), GVM_STREAM_VALIDATOR_OK, gvm_stream_validator_write(), VALID_DATA, and VALID_DATA_HASH.

| Ensure | ( | streamvalidator | , |
| wrapper_checksum_only_does_not_enforce_size | ) |
Definition at line 381 of file streamvalidator_tests.c.
References gvm_stream_validator_end(), gvm_stream_validator_free(), GVM_STREAM_VALIDATOR_HASH_MISMATCH, gvm_stream_validator_new(), GVM_STREAM_VALIDATOR_OK, gvm_stream_validator_write(), TOO_LONG_DATA, and VALID_DATA_HASH.

| Ensure | ( | streamvalidator | , |
| wrapper_rejects_invalid_hash_syntax | ) |
Definition at line 398 of file streamvalidator_tests.c.
References GVM_STREAM_VALIDATOR_INVALID_HASH_SYNTAX, and gvm_stream_validator_new().

| int main | ( | int | argc, |
| char ** | argv ) |
Definition at line 412 of file streamvalidator_tests.c.