Data Structures | Defines | Functions
test.h File Reference

Self-test infrastructure. More...

#include <ipxe/tables.h>

Go to the source code of this file.

Data Structures

struct  self_test
 A self-test set. More...


#define SELF_TESTS   __table ( struct self_test, "self_tests" )
 Self-test table.
#define __self_test   __table_entry ( SELF_TESTS, 01 )
 Declare a self-test.
#define okx(success, file, line)   test_ok ( success, file, line, #success )
 Report test result.
#define ok(success)   okx ( success, __FILE__, __LINE__ )


void test_ok (int success, const char *file, unsigned int line, const char *test)
 Report test result.

Detailed Description

Self-test infrastructure.

Definition in file test.h.

Define Documentation

#define SELF_TESTS   __table ( struct self_test, "self_tests" )

Self-test table.

Definition at line 29 of file test.h.

Referenced by run_all_tests().

struct self_test iobuf_test __self_test   __table_entry ( SELF_TESTS, 01 )

Declare a self-test.

I/O buffer self-test.

Definition at line 32 of file test.h.

#define okx (   success,
)    test_ok ( success, file, line, #success )

Report test result.

successTest succeeded
fileFile name
lineLine number

Definition at line 44 of file test.h.

Referenced by alloc_iob_fail_okx(), alloc_iob_okx(), asn1_okx(), base16_decode_okx(), base16_encode_okx(), base64_decode_okx(), base64_encode_okx(), cipher_decrypt_okx(), cipher_encrypt_okx(), cms_signature_okx(), cms_verify_fail_okx(), cms_verify_okx(), deflate_okx(), digest_frag_okx(), dns_compare_fail_okx(), dns_compare_okx(), dns_copy_fail_okx(), dns_copy_okx(), dns_decode_fail_okx(), dns_decode_okx(), dns_encode_fail_okx(), dns_encode_okx(), dns_list_okx(), ffsl_okx(), ffsll_okx(), flsl_okx(), flsll_okx(), inet6_aton_fail_okx(), inet6_aton_okx(), inet6_ntoa_okx(), inet_aton_fail_okx(), inet_aton_okx(), inet_ntoa_okx(), ipv6_route_okx(), ipv6_table_okx(), linebuf_accumulated_okx(), linebuf_consume_okx(), linebuf_empty_okx(), linebuf_init_okx(), ntlm_authenticate_okx(), ntlm_data_okx(), ntlm_key_okx(), peerdist_info_block_okx(), peerdist_info_okx(), peerdist_info_passphrase_okx(), peerdist_info_segment_okx(), pixbuf_okx(), profile_okx(), s64divmod_okx(), setjmp_return_ok(), snprintf_okx(), tcpip_okx(), tcpip_random_okx(), u64divmod_okx(), uri_churi_okx(), uri_dup_okx(), uri_format_okx(), uri_okx(), uri_params_list_okx(), uri_params_okx(), uri_parse_okx(), uri_port_okx(), uri_pxe_okx(), uri_resolve_okx(), uri_resolve_path_okx(), x509_cached_okx(), x509_certificate_okx(), x509_chain_okx(), x509_check_issuer_fail_okx(), x509_check_issuer_okx(), x509_check_name_fail_okx(), x509_check_name_okx(), x509_check_root_fail_okx(), x509_check_root_okx(), x509_check_time_fail_okx(), x509_check_time_okx(), x509_fingerprint_okx(), x509_validate_chain_fail_okx(), and x509_validate_chain_okx().

#define ok (   success)    okx ( success, __FILE__, __LINE__ )

Function Documentation

void test_ok ( int  success,
const char *  file,
unsigned int  line,
const char *  test 

Report test result.

successTest succeeded
fileTest code file
lineTest code line
testTest code

Definition at line 55 of file test.c.

References assert, self_test::failures, self_test::name, NULL, printf(), and self_test::total.


        /* Sanity check */
        assert ( current_tests != NULL );

        /* Increment test counter */

        /* Report failure if applicable */
        if ( ! success ) {
                printf ( "FAILURE: \"%s\" test failed at %s line %d: ( %s )\n",
                         current_tests->name, file, line, test );