Beispiel #1
0
/**
 * \brief Run ADC unit tests
 *
 * Initializes the system and serial output, then sets up the
 * ADC unit test suite and runs it.
 */
int main(void)
{
	system_init();
	delay_init();
	cdc_uart_init();
	test_dac_init();

	/* Define Test Cases */
	DEFINE_TEST_CASE(adc_init_test,
			NULL,
			run_adc_init_test,
			NULL,
			"Testing ADC Initialization");

	DEFINE_TEST_CASE(adc_polled_mode_test,
			NULL,
			run_adc_polled_mode_test,
			NULL,
			"Testing ADC single ended mode by polling");

	DEFINE_TEST_CASE(adc_callback_mode_test,
			setup_adc_callback_mode_test,
			run_adc_callback_mode_test,
			cleanup_adc_callback_mode_test,
			"Testing ADC single ended mode by interrupt");

	DEFINE_TEST_CASE(adc_average_mode_test,
			setup_adc_average_mode_test,
			run_adc_average_mode_test,
			NULL,
			"Testing ADC average mode");

	DEFINE_TEST_CASE(adc_window_mode_test,
			setup_adc_window_mode_test,
			run_adc_window_mode_test,
			cleanup_adc_window_mode_test,
			"Testing ADC window mode");

	/* Put test case addresses in an array */
	DEFINE_TEST_ARRAY(adc_tests) = {
		&adc_init_test,
		&adc_polled_mode_test,
		&adc_callback_mode_test,
		&adc_average_mode_test,
		&adc_window_mode_test,
	};

	/* Define the test suite */
	DEFINE_TEST_SUITE(adc_test_suite, adc_tests,
			"SAM ADC driver test suite");

	/* Run all tests in the suite*/
	test_suite_run(&adc_test_suite);

	while (true) {
		/* Intentionally left empty */
	}
}
Beispiel #2
0
/**
 * \brief Run AC unit tests
 *
 * Initializes the system and serial output, then sets up the
 * AC unit test suite and runs it.
 */
int main(void)
{
	system_init();
	delay_init();
	cdc_uart_init();
	test_dac_init();

	/* Define Test Cases */
	DEFINE_TEST_CASE(ac_init_test, NULL,
			run_ac_init_test, NULL,
			"Testing Analog Comparator Module Initialization");

	DEFINE_TEST_CASE(ac_single_shot_test, NULL,
			run_ac_single_shot_test, NULL,
			"Testing AC single shot comparison");

	DEFINE_TEST_CASE(ac_callback_mode_test,
			setup_ac_callback_mode_test,
			run_ac_callback_mode_test,
			cleanup_ac_callback_mode_test,
			"Testing AC callback mode");

	DEFINE_TEST_CASE(ac_window_mode_test,
			setup_ac_window_mode_test,
			run_ac_window_mode_test, NULL,
			"Testing AC window mode with single shot");

	/* Put test case addresses in an array */
	DEFINE_TEST_ARRAY(ac_tests) = {
		&ac_init_test,
		&ac_single_shot_test,
		&ac_callback_mode_test,
		&ac_window_mode_test,
	};

	/* Define the test suite */
	DEFINE_TEST_SUITE(ac_test_suite, ac_tests,
			"SAM AC driver test suite");

	/* Run all tests in the suite*/
	test_suite_run(&ac_test_suite);

	while (true) {
		/* Intentionally left empty */
	}
}