From: Stephan Veigl Date: Fri, 24 Jun 2011 12:33:02 +0000 (+0200) Subject: test: fix test cases and add new test function X-Git-Tag: v1.0a9~13 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=725bede6f51610650d2f23ff47e50165aff250c9;p=sx%2Fsimavr.git 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 --- 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);