Test suite core declarations.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
Data Structures | |
struct | test_case |
A test case. More... | |
struct | test_suite |
A test suite. More... | |
Macros | |
#define | ARRAY_LEN(a) (sizeof(a) / sizeof((a)[0])) |
Convenience macro for counting elements in arrays. More... | |
#define | Assert(expr) |
Assert() macro definition for unit testing. More... | |
Wrappers for printing debug information | |
| |
#define | dbg(__fmt_) printf(__fmt_) |
#define | dbg_info(__fmt_,...) printf(__fmt_, __VA_ARGS__) |
#define | dbg_error(_x,...) printf(_x, __VA_ARGS__) |
#define | dbg_putchar(c) putc(c, stdout) |
#define | dbg_vprintf_pgm(...) vfprintf(stdout, __VA_ARGS__) |
Test suite definition macros | |
#define | DEFINE_TEST_CASE(_sym, _setup, _run, _cleanup, _name) |
Create a test case struct. More... | |
#define | DEFINE_TEST_ARRAY(_sym) const struct test_case *const _sym[] |
Create an array of test case pointers. More... | |
#define | DEFINE_TEST_SUITE(_sym, _test_array, _name) |
Create a test suite. More... | |
Functions | |
void | test_case_fail (const struct test_case *test, int result, const char *file, unsigned int line, const char *fmt,...) |
Report a failure and jump out of current test case function. More... | |
Test suite interaction | |
int | test_suite_run (const struct test_suite *suite) |
Run a test suite. More... | |
Test data access | |
void * | test_priv_data |
Data pointer for test cases. More... | |
static void | test_set_data (void *data) |
Set private data pointer for the current test. More... | |
static void * | test_get_data (void) |
Get the private data pointer for the current test. More... | |
Test case pointer access | |
struct test_case * | test_case_ptr |
Pointer to current test case. More... | |
static void | test_set_case (const struct test_case *test) |
Set pointer to current test. More... | |
static struct test_case * | test_get_case (void) |
Get pointer to current test. More... | |
Test result reporting | |
#define | test_fail(test, result,...) test_case_fail(test, result, __FILE__, __LINE__, __VA_ARGS__) |
Fail the test. More... | |
#define | test_assert_true(test, condition,...) |
Verify that condition is true. More... | |
#define | test_assert_false(test, condition,...) test_assert_true(test, !(condition), __VA_ARGS__) |
Verify that condition is false. More... | |
enum | test_status { TEST_ERROR = -1, TEST_PASS = 0, TEST_FAIL = 1 } |
Status codes returned by test cases and fixtures. More... | |
#define Assert | ( | expr | ) |
Assert() macro definition for unit testing.
The Assert() macro is set up to use test_assert_true(), as this will only halt execution of the current test, allowing the remaining tests a chance to complete.
Referenced by _ac_set_config(), _adc_configure_ain_pin(), _adc_get_inst_index(), _dac_set_config(), _dma_set_config(), _i2c_master_async_address_response(), _i2c_master_interrupt_handler(), _i2c_master_read(), _i2c_master_read_packet(), _i2c_master_write(), _i2c_master_write_packet(), _i2c_slave_interrupt_handler(), _i2c_slave_set_config(), _i2c_slave_wait_for_bus(), _rtc_calendar_set_config(), _rtc_count_set_config(), _sercom_default_handler(), _sercom_get_default_pad(), _sercom_get_sercom_inst_index(), _spi_check_config(), _spi_clear_tx_complete_flag(), _spi_master_vec_int_handler(), _spi_read_buffer(), _spi_set_config(), _spi_transceive_buffer(), _spi_write_buffer(), _system_pinmux_config(), _tc_get_inst_index(), _tcc_get_inst_index(), _tcc_set_compare_value(), _tcc_set_top_value(), _usart_read_buffer(), _usart_set_config(), _usart_write_buffer(), ac_chan_clear_status(), ac_chan_disable(), ac_chan_enable(), ac_chan_get_config_defaults(), ac_chan_get_status(), ac_chan_is_ready(), ac_chan_set_config(), ac_chan_trigger_single_shot(), ac_disable(), ac_disable_callback(), ac_disable_events(), ac_enable(), ac_enable_callback(), ac_enable_events(), ac_get_config_defaults(), ac_init(), ac_is_syncing(), ac_register_callback(), ac_reset(), ac_unregister_callback(), ac_win_clear_status(), ac_win_disable(), ac_win_enable(), ac_win_get_config_defaults(), ac_win_get_status(), ac_win_is_ready(), ac_win_set_config(), adc_abort_job(), adc_clear_status(), adc_disable(), adc_disable_callback(), adc_disable_events(), adc_disable_interrupt(), adc_disable_positive_input_sequence(), adc_enable(), adc_enable_callback(), adc_enable_events(), adc_enable_interrupt(), adc_enable_positive_input_sequence(), adc_flush(), adc_get_config_defaults(), adc_get_job_status(), adc_get_sequence_status(), adc_get_status(), adc_init(), adc_read(), adc_read_buffer_job(), adc_register_callback(), adc_reset(), adc_set_master_slave_mode(), adc_set_negative_input(), adc_set_positive_input(), adc_set_window_mode(), adc_start_conversion(), adc_unregister_callback(), bodvdd_get_config_defaults(), bodvdd_set_config(), can_get_config_defaults(), can_init(), ccl_get_config_defaults(), ccl_lut_get_config_defaults(), ccl_lut_set_config(), cpu_irq_leave_critical(), dac_chan_abort_job(), dac_chan_disable_callback(), dac_chan_disable_output_buffer(), dac_chan_enable_callback(), dac_chan_enable_output_buffer(), dac_chan_get_config_defaults(), dac_chan_get_job_status(), dac_chan_write(), dac_chan_write_buffer_job(), dac_chan_write_buffer_wait(), dac_chan_write_job(), dac_clear_status(), dac_disable(), dac_disable_events(), dac_enable(), dac_enable_events(), dac_get_config_defaults(), dac_get_status(), dac_init(), dac_is_syncing(), dac_register_callback(), dac_reset(), dac_unregister_callback(), dma_abort_job(), dma_allocate(), dma_crc_get_config_defaults(), dma_descriptor_get_config_defaults(), dma_disable_callback(), dma_enable_callback(), dma_free(), dma_get_config_defaults(), dma_get_job_status(), dma_is_busy(), dma_register_callback(), dma_reset_descriptor(), dma_resume_job(), dma_start_transfer_job(), dma_suspend_job(), dma_trigger_transfer(), dma_unregister_callback(), dma_update_descriptor(), DMAC_Handler(), events_ack_interrupt(), events_allocate(), events_attach_user(), events_detach_user(), events_disable_interrupt_source(), events_enable_interrupt_source(), events_get_config_defaults(), events_is_busy(), events_is_detected(), events_is_interrupt_set(), events_is_overrun(), events_is_users_ready(), events_release(), events_trigger(), extint_chan_disable_callback(), extint_chan_enable_callback(), extint_chan_get_config_defaults(), extint_chan_set_config(), extint_disable_events(), extint_enable_events(), extint_nmi_get_config_defaults(), extint_nmi_set_config(), extint_register_callback(), extint_unregister_callback(), freqm_clear_overflow(), freqm_disable(), freqm_disable_callback(), freqm_enable(), freqm_enable_callback(), freqm_get_config_defaults(), freqm_get_result_value(), freqm_init(), freqm_register_callback(), freqm_start_measure(), freqm_unregister_callback(), gfx_mono_draw_char(), gfx_mono_draw_char_hugemem(), gfx_mono_draw_char_progmem(), gfx_mono_draw_progmem_string(), gfx_mono_draw_string(), gfx_mono_get_progmem_string_bounding_box(), gfx_mono_get_string_bounding_box(), i2c_master_cancel_job(), i2c_master_disable(), i2c_master_disable_callback(), i2c_master_enable(), i2c_master_enable_callback(), i2c_master_get_config_defaults(), i2c_master_get_job_status(), i2c_master_init(), i2c_master_is_syncing(), i2c_master_read_bytes(), i2c_master_read_packet_job(), i2c_master_read_packet_job_no_nack(), i2c_master_read_packet_job_no_stop(), i2c_master_read_packet_wait(), i2c_master_read_packet_wait_no_nack(), i2c_master_read_packet_wait_no_stop(), i2c_master_register_callback(), i2c_master_reset(), i2c_master_send_nack(), i2c_master_send_stop(), i2c_master_unregister_callback(), i2c_master_write_bytes(), i2c_master_write_packet_job(), i2c_master_write_packet_job_no_stop(), i2c_master_write_packet_wait(), i2c_master_write_packet_wait_no_stop(), i2c_slave_cancel_job(), i2c_slave_clear_status(), i2c_slave_disable(), i2c_slave_disable_callback(), i2c_slave_disable_nack_on_address(), i2c_slave_enable(), i2c_slave_enable_callback(), i2c_slave_enable_nack_on_address(), i2c_slave_get_config_defaults(), i2c_slave_get_direction_wait(), i2c_slave_get_job_status(), i2c_slave_get_status(), i2c_slave_init(), i2c_slave_is_syncing(), i2c_slave_read_packet_job(), i2c_slave_read_packet_wait(), i2c_slave_register_callback(), i2c_slave_reset(), i2c_slave_unregister_callback(), i2c_slave_write_packet_job(), i2c_slave_write_packet_wait(), iso7816_data_block_atr(), iso7816_init(), iso7816_xfr_block_tpdu_t0(), main(), nvm_get_config_defaults(), nvm_get_parameters(), nvm_is_page_locked(), nvm_set_config(), port_disable_input_event(), port_enable_input_event(), port_get_config_defaults(), port_group_get_input_level(), port_group_get_output_level(), port_group_set_config(), port_group_set_output_level(), port_group_toggle_output_level(), port_input_event_get_config_defaults(), port_input_event_set_config(), port_pin_set_config(), rtc_calendar_clear_alarm_match(), rtc_calendar_clear_overflow(), rtc_calendar_clear_periodic_interval(), rtc_calendar_disable(), rtc_calendar_disable_callback(), rtc_calendar_disable_events(), rtc_calendar_enable(), rtc_calendar_enable_callback(), rtc_calendar_enable_events(), rtc_calendar_frequency_correction(), rtc_calendar_get_alarm(), rtc_calendar_get_config_defaults(), rtc_calendar_get_time(), rtc_calendar_init(), rtc_calendar_is_alarm_match(), rtc_calendar_is_overflow(), rtc_calendar_is_periodic_interval(), rtc_calendar_is_syncing(), rtc_calendar_reset(), rtc_calendar_set_alarm(), rtc_calendar_set_time(), rtc_calendar_swap_time_mode(), rtc_count_clear_compare_match(), rtc_count_clear_overflow(), rtc_count_clear_periodic_interval(), rtc_count_disable(), rtc_count_disable_callback(), rtc_count_disable_events(), rtc_count_enable(), rtc_count_enable_callback(), rtc_count_enable_events(), rtc_count_frequency_correction(), rtc_count_get_compare(), rtc_count_get_config_defaults(), rtc_count_get_count(), rtc_count_get_period(), rtc_count_init(), rtc_count_is_compare_match(), rtc_count_is_overflow(), rtc_count_is_periodic_interval(), rtc_count_is_syncing(), rtc_count_reset(), rtc_count_set_compare(), rtc_count_set_count(), rtc_count_set_period(), rtc_read_general_purpose_reg(), rtc_tamper_clear_detect_flag(), rtc_tamper_get_config_defaults(), rtc_tamper_get_detect_flag(), rtc_write_general_purpose_reg(), sd_mmc_select_slot(), sd_mmc_start_read_blocks(), sd_mmc_start_write_blocks(), sdadc_abort_job(), sdadc_clear_status(), sdadc_disable(), sdadc_disable_callback(), sdadc_disable_events(), sdadc_disable_interrupt(), sdadc_enable(), sdadc_enable_callback(), sdadc_enable_events(), sdadc_enable_interrupt(), sdadc_flush(), sdadc_get_config_defaults(), sdadc_get_job_status(), sdadc_get_sequence_status(), sdadc_get_status(), sdadc_init(), sdadc_is_syncing(), sdadc_read(), sdadc_read_buffer_job(), sdadc_register_callback(), sdadc_reset(), sdadc_set_mux_input(), sdadc_set_window_mode(), sdadc_start_conversion(), sdadc_unregister_callback(), sleepmgr_get_sleep_mode(), sleepmgr_sleep(), spi_attach_slave(), spi_disable(), spi_disable_callback(), spi_enable(), spi_enable_callback(), spi_get_config_defaults(), spi_init(), spi_is_ready_to_read(), spi_is_ready_to_write(), spi_is_syncing(), spi_is_write_complete(), spi_master_vec_disable(), spi_master_vec_enable(), spi_master_vec_init(), spi_master_vec_reset(), spi_master_vec_transceive_buffer_job(), spi_read(), spi_read_buffer_job(), spi_read_buffer_wait(), spi_register_callback(), spi_reset(), spi_select_slave(), spi_set_baudrate(), spi_slave_inst_get_config_defaults(), spi_transceive_buffer_job(), spi_transceive_buffer_wait(), spi_transceive_wait(), spi_unregister_callback(), spi_write(), spi_write_buffer_job(), spi_write_buffer_wait(), system_apb_clock_clear_mask(), system_apb_clock_set_mask(), system_clock_init(), system_clock_source_disable(), system_clock_source_enable(), system_clock_source_osc32k_get_config_defaults(), system_clock_source_osc48m_get_config_defaults(), system_clock_source_osc48m_set_config(), system_clock_source_osculp32k_get_config_defaults(), system_clock_source_write_calibration(), system_clock_source_xosc32k_get_config_defaults(), system_clock_source_xosc_get_config_defaults(), system_clock_source_xosc_set_config(), system_flash_set_waitstates(), system_gclk_chan_disable(), system_gclk_chan_get_config_defaults(), system_gclk_chan_set_config(), system_gclk_gen_get_config_defaults(), system_gclk_gen_set_config(), system_interrupt_clear_pending(), system_interrupt_is_pending(), system_interrupt_set_pending(), system_interrupt_set_priority(), system_peripheral_lock(), system_peripheral_lock_always(), system_peripheral_unlock(), system_pinmux_get_config_defaults(), system_pinmux_get_group_from_gpio_pin(), system_pinmux_group_set_config(), system_pinmux_group_set_input_sample_mode(), system_standby_get_config_defaults(), system_standby_set_config(), system_voltage_reference_disable(), system_voltage_reference_enable(), system_voltage_reference_get_config_defaults(), system_voltage_reference_set_config(), system_voltage_regulator_get_config_defaults(), tc_clear_status(), tc_disable(), tc_disable_callback(), tc_disable_events(), tc_dma_trigger_command(), tc_enable(), tc_enable_callback(), tc_enable_events(), tc_get_capture_value(), tc_get_config_defaults(), tc_get_count_value(), tc_get_status(), tc_init(), tc_is_syncing(), tc_register_callback(), tc_reset(), tc_set_compare_value(), tc_set_count_value(), tc_set_top_value(), tc_start_counter(), tc_stop_counter(), tc_sync_read_count(), tc_unregister_callback(), tc_update_double_buffer(), tcc_clear_status(), tcc_disable(), tcc_disable_callback(), tcc_disable_circular_buffer_compare(), tcc_disable_circular_buffer_top(), tcc_disable_double_buffering(), tcc_disable_events(), tcc_dma_trigger_command(), tcc_enable(), tcc_enable_callback(), tcc_enable_circular_buffer_compare(), tcc_enable_circular_buffer_top(), tcc_enable_double_buffering(), tcc_enable_events(), tcc_force_double_buffer_update(), tcc_get_capture_value(), tcc_get_count_value(), tcc_get_status(), tcc_init(), tcc_is_running(), tcc_is_syncing(), tcc_lock_double_buffer_update(), tcc_register_callback(), tcc_reset(), tcc_restart_counter(), tcc_set_compare_value(), tcc_set_count_direction(), tcc_set_count_value(), tcc_set_double_buffer_compare_values(), tcc_set_double_buffer_top_values(), tcc_set_pattern(), tcc_set_ramp_index(), tcc_set_top_value(), tcc_stop_counter(), tcc_toggle_count_direction(), tcc_unlock_double_buffer_update(), tcc_unregister_callback(), tsens_disable_events(), tsens_enable_events(), tsens_get_config_defaults(), TSENS_Handler(), tsens_init(), tsens_read(), tsens_read_job(), tsens_register_callback(), tsens_unregister_callback(), usart_abort_job(), usart_disable(), usart_disable_callback(), usart_disable_transceiver(), usart_enable(), usart_enable_callback(), usart_enable_transceiver(), usart_get_config_defaults(), usart_get_job_status(), usart_init(), usart_is_syncing(), usart_read_buffer_job(), usart_read_buffer_wait(), usart_read_job(), usart_read_wait(), usart_register_callback(), usart_reset(), usart_unregister_callback(), usart_write_buffer_job(), usart_write_buffer_wait(), usart_write_job(), usart_write_wait(), wdt_disable_callback(), wdt_enable_callback(), wdt_get_config_defaults(), wdt_register_callback(), wdt_set_config(), and wdt_unregister_callback().