From 725bede6f51610650d2f23ff47e50165aff250c9 Mon Sep 17 00:00:00 2001 From: Stephan Veigl Date: Fri, 24 Jun 2011 14:33:02 +0200 Subject: [PATCH] test: fix test cases and add new test function - add tests_assert_uart_receive_avr() function (called by tests_assert_uart_receive() and test cases) - fix DDR settings Signed-off-by: Stephan Veigl --- tests/atmega48_watchdog_test.c | 3 ++- tests/atmega88_timer16.c | 2 +- tests/tests.c | 15 +++++++++++++-- tests/tests.h | 4 ++++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/tests/atmega48_watchdog_test.c b/tests/atmega48_watchdog_test.c index bae181c..cbcf4be 100644 --- a/tests/atmega48_watchdog_test.c +++ b/tests/atmega48_watchdog_test.c @@ -55,7 +55,8 @@ ISR(WDT_vect) int main() { stdout = &mystdout; - + DDRD = (1<maxlen = 4096; } -void tests_assert_uart_receive(const char *elfname, +void tests_assert_uart_receive_avr(avr_t *avr, unsigned long run_usec, const char *expected, char uart) { - avr_t *avr = tests_init_avr(elfname); struct output_buffer buf; init_output_buffer(&buf); @@ -199,6 +198,18 @@ void tests_assert_uart_receive(const char *elfname, _fail(NULL, 0, "UART outputs differ: expected \"%s\", got \"%s\"", expected, buf.str); } +void tests_assert_uart_receive(const char *elfname, + unsigned long run_usec, + const char *expected, + char uart) { + avr_t *avr = tests_init_avr(elfname); + + tests_assert_uart_receive_avr(avr, + run_usec, + expected, + uart); +} + void tests_assert_cycles_at_least(unsigned long n) { if (tests_cycle_count < n) _fail(NULL, 0, "Program ran for too few cycles (%" diff --git a/tests/tests.h b/tests/tests.h index 14e435b..1496b93 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -28,6 +28,10 @@ void tests_assert_uart_receive(const char *elfname, unsigned long run_usec, const char *expected, // what we should get char uart); +void tests_assert_uart_receive_avr(avr_t *avr, + unsigned long run_usec, + const char *expected, + char uart); void tests_assert_cycles_at_least(unsigned long n); void tests_assert_cycles_at_most(unsigned long n); -- 2.39.5