OpenVPN
|
This is a set of useful assert macros like the standard C libary's assert(3) macro. More...
Macros | |
#define | assert_true(c) |
#define | assert_false(c) |
#define | assert_return_code(rc, error) |
#define | assert_non_null(c) |
#define | assert_null(c) |
#define | assert_ptr_equal(a, b) |
#define | assert_ptr_not_equal(a, b) |
#define | assert_int_equal(a, b) |
#define | assert_int_not_equal(a, b) |
#define | assert_string_equal(a, b) |
#define | assert_string_not_equal(a, b) |
#define | assert_memory_equal(a, b, size) |
#define | assert_memory_not_equal(a, b, size) |
#define | assert_in_range(value, minimum, maximum) |
#define | assert_not_in_range(value, minimum, maximum) |
#define | assert_in_set(value, values, number_of_values) _assert_in_set(value, values, number_of_values, __FILE__, __LINE__) |
#define | assert_not_in_set(value, values, number_of_values) _assert_not_in_set(value, values, number_of_values, __FILE__, __LINE__) |
This is a set of useful assert macros like the standard C libary's assert(3) macro.
On an assertion failure a cmocka assert macro will write the failure to the standard error stream and signal a test failure. Due to limitations of the C language the general C standard library assert() and cmocka's assert_true() and assert_false() macros can only display the expression that caused the assert failure. cmocka's type specific assert macros, assert_{type}_equal() and assert_{type}_not_equal(), display the data that caused the assertion failure which increases data visibility aiding debugging of failing test cases.
#define assert_false | ( | c | ) |
Definition at line 1063 of file cmocka.h.
Referenced by argv_printf__group_sep_in_arg__fail_no_ouput(), auth_token_test_key_load(), crypto_pem_encode_decode_loopback(), test_buffer_strprefix(), test_extract_client_ciphers(), test_false(), test_packet_id_write_long_wrap(), test_packet_id_write_short_wrap(), tls_crypt_fail_invalid_key(), tls_crypt_fail_msg_too_long(), tls_crypt_fail_replay(), tls_crypt_v2_wrap_too_long_metadata(), tls_crypt_v2_wrap_unwrap_dst_too_small(), and tls_crypt_v2_wrap_unwrap_wrong_key().
#define assert_in_range | ( | value, | |
minimum, | |||
maximum | |||
) |
Definition at line 1297 of file cmocka.h.
Referenced by test_value_range().
#define assert_in_set | ( | value, | |
values, | |||
number_of_values | |||
) | _assert_in_set(value, values, number_of_values, __FILE__, __LINE__) |
#define assert_int_equal | ( | a, | |
b | |||
) |
Definition at line 1174 of file cmocka.h.
Referenced by __attribute__(), argv_insert_head__empty_argv__head_only(), argv_insert_head__non_empty_argv__head_added(), argv_parse_cmd__command_and_extra_options__argc_correct(), argv_parse_cmd__command_string__argc_correct(), argv_printf__combined_path_with_spaces__argc_correct(), argv_printf__embedded_format_directive__replaced_in_output(), argv_printf__empty_parameter__argc_correct(), argv_printf__group_sep_in_arg__fail_no_ouput(), argv_printf__long_args__data_correct(), argv_printf__multiple_spaces_in_format__parsed_as_one(), argv_printf_cat__multiple_spaces_in_format__parsed_as_one(), argv_printf_cat__used_twice__argc_correct(), auth_token_basic_test(), auth_token_fail_invalid_key(), auth_token_test_empty_user(), auth_token_test_known_keys(), auth_token_test_session_mismatch(), auth_token_test_timeout(), crypto_pem_encode_decode_loopback(), group_setup_failing(), int_test_success(), mock_function_call_times(), prestate_setup_test(), prestate_test(), string_to_status_code_test(), test_add(), test_bad_dish(), test_buffer_list_aggregate_separator_all(), test_buffer_list_aggregate_separator_emptybuffers(), test_buffer_list_aggregate_separator_noop(), test_buffer_list_aggregate_separator_nosep(), test_buffer_list_aggregate_separator_two(), test_buffer_list_aggregate_separator_zerolen(), test_buffer_list_full(), test_connect_to_customer_database(), test_connect_to_product_database(), test_connect_to_product_database_bad_url(), test_connect_to_product_database_missing_parameter(), test_divide(), test_example_main(), test_example_main_no_args(), test_find_item_by_value(), test_find_operator_function_by_string_found(), test_get_customer_id_by_name(), test_multiply(), test_order_hotdog(), test_perform_operation(), test_perform_operation_first_arg_not_integer(), test_perform_operation_missing_argument(), test_perform_operation_no_arguments(), test_perform_operation_no_integer_after_operator(), test_perform_operation_unknown_operator(), test_subtract(), test_value_equal(), tls_crypt_loopback(), tls_crypt_loopback_max_len(), tls_crypt_loopback_zero_len(), torture_test_malloc(), and torture_test_realloc().
#define assert_int_not_equal | ( | a, | |
b | |||
) |
Definition at line 1195 of file cmocka.h.
Referenced by auth_token_test_session_mismatch().
#define assert_memory_equal | ( | a, | |
b, | |||
size | |||
) |
Definition at line 1254 of file cmocka.h.
Referenced by crypto_pem_encode_decode_loopback(), crypto_test_tls_prf(), tls_crypt_loopback(), tls_crypt_loopback_max_len(), and tls_crypt_loopback_zero_len().
#define assert_memory_not_equal | ( | a, | |
b, | |||
size | |||
) |
#define assert_non_null | ( | c | ) |
Definition at line 1102 of file cmocka.h.
Referenced by _expect_function_call(), _test_malloc(), add_symbol_value(), check_for_leftover_values(), check_in_range(), check_memory(), check_not_in_range(), check_not_memory(), display_allocated_blocks(), expect_memory_setup(), expect_set(), free_allocated_blocks(), free_symbol_map_value(), free_value(), get_symbol_value(), group_setup(), initialize_source_location(), int_test_ignored(), list_add(), list_add_value(), list_empty(), list_find(), list_first(), list_free(), list_remove(), list_remove_free(), malloc_setup_test(), malloc_teardown_test(), pattern_not_found__returns_original(), prestate_setup_test(), prestate_test(), remove_always_return_values(), remove_always_return_values_from_list(), replace_longer_text__multiple_times__match_all_matches_are_replaced(), replace_single_char__multiple_times__match_all_matches_are_replaced(), replace_single_char__one_time__match_is_replaced(), set_source_location(), setup(), source_location_is_set(), test_buffer_free_gc_two(), test_perform_operation(), tls_crypt_fail_msg_too_long(), tls_crypt_loopback_max_len(), torture_test_malloc(), torture_test_realloc(), torture_test_realloc_set0(), and value_in_set_display_error().
#define assert_not_in_range | ( | value, | |
minimum, | |||
maximum | |||
) |
#define assert_not_in_set | ( | value, | |
values, | |||
number_of_values | |||
) | _assert_not_in_set(value, values, number_of_values, __FILE__, __LINE__) |
#define assert_null | ( | c | ) |
Definition at line 1119 of file cmocka.h.
Referenced by _run_tests(), pass_any_empty_string__returns_null(), pass_any_null_param__returns_null(), test_bad_dish(), test_buffer_free_gc_one(), test_buffer_list_aggregate_separator_empty(), test_find_operator_function_by_string_not_found(), test_find_operator_function_by_string_valid_null_functions(), and torture_test_realloc_set0().
#define assert_ptr_equal | ( | a, | |
b | |||
) |
Definition at line 1136 of file cmocka.h.
Referenced by test_buffer_free_gc_one(), test_buffer_free_gc_two(), test_check_ncp_ciphers_list(), and test_poor_man().
#define assert_ptr_not_equal | ( | a, | |
b | |||
) |
Definition at line 1155 of file cmocka.h.
Referenced by test_buffer_free_gc_two().
#define assert_return_code | ( | rc, | |
error | |||
) |
Definition at line 1082 of file cmocka.h.
Referenced by test_assert_return_code(), and test_assert_return_code_fail().
#define assert_string_equal | ( | a, | |
b | |||
) |
Definition at line 1214 of file cmocka.h.
Referenced by argv_insert_head__empty_argv__head_only(), argv_insert_head__non_empty_argv__head_added(), argv_printf__embedded_format_directive__replaced_in_output(), argv_printf__long_args__data_correct(), argv_str__empty_argv__empty_output(), argv_str__multiple_argv__correct_output(), auth_token_test_env(), auth_token_test_known_keys(), auth_token_test_random_keys(), get_status_code_string_test(), pattern_not_found__returns_original(), replace_longer_text__multiple_times__match_all_matches_are_replaced(), replace_single_char__multiple_times__match_all_matches_are_replaced(), replace_single_char__one_time__match_is_replaced(), test_check_ncp_ciphers_list(), test_compat_lzo_string(), test_extract_client_ciphers(), test_find_item_by_value(), test_ncp_best(), test_order_hotdog(), test_poor_man(), test_translate_cipher(), and torture_test_realloc().
#define assert_string_not_equal | ( | a, | |
b | |||
) |
#define assert_true | ( | c | ) |
Definition at line 1045 of file cmocka.h.
Referenced by _cmocka_run_group_tests(), _expect_function_call(), _run_tests(), _will_return(), add_symbol_value(), auth_token_test_key_load(), auth_token_test_random_keys(), check_for_leftover_values(), crypto_pem_encode_decode_loopback(), example_test_fprintf(), expect_memory_setup(), expect_set(), get_symbol_value(), remove_always_return_values(), test_assert_return_code(), test_buffer_strprefix(), test_check_skip(), test_connect_to_customer_database(), test_extract_client_ciphers(), test_find_item_by_value(), test_packet_id_write_long(), test_packet_id_write_long_prepend(), test_packet_id_write_long_wrap(), test_packet_id_write_short(), test_packet_id_write_short_prepend(), test_sort_items_by_key(), test_true(), tls_crypt_fail_invalid_key(), tls_crypt_fail_replay(), tls_crypt_ignore_replay(), tls_crypt_loopback(), tls_crypt_loopback_max_len(), tls_crypt_loopback_zero_len(), tls_crypt_v2_wrap_too_long_metadata(), tls_crypt_v2_wrap_unwrap_dst_too_small(), tls_crypt_v2_wrap_unwrap_max_metadata(), tls_crypt_v2_wrap_unwrap_no_metadata(), and tls_crypt_v2_wrap_unwrap_wrong_key().