Search
lxdream.org :: lxdream/test/sh4/testsh4.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename test/sh4/testsh4.c
changeset 228:70adc8ffa8d1
prev226:0eeeb25447d3
next231:a9e61a96a885
author nkeynes
date Mon Sep 25 11:13:56 2006 +0000 (14 years ago)
permissions -rw-r--r--
last change Commit BF tests and initial exception handler
file annotate diff log raw
1.1 --- a/test/sh4/testsh4.c Sat Sep 23 10:35:29 2006 +0000
1.2 +++ b/test/sh4/testsh4.c Mon Sep 25 11:13:56 2006 +0000
1.3 @@ -20,14 +20,38 @@
1.4 }
1.5 }
1.6
1.7 +extern unsigned int interrupt_pc;
1.8 +extern unsigned int interrupt_count;
1.9 +
1.10 +int assert_exception_caught( char *testname, int number, unsigned int expectedpc )
1.11 +{
1.12 + if( interrupt_count == 0 ) {
1.13 + fprintf( stderr, "%s: Test %d failed: Expected exception not delivered\n",
1.14 + testname, number );
1.15 + return 1;
1.16 + } else if( interrupt_count != 1 ) {
1.17 + fprintf( stderr, "%s: Test %d failed: Expected exception delivered %d times!\n",
1.18 + testname, number, interrupt_count );
1.19 + return 1;
1.20 + } else if( interrupt_pc != expectedpc ) {
1.21 + fprintf( stderr, "%s: Test %d failed: Expected exception at PC %08X, but was %08X\n",
1.22 + testname, number, expectedpc, interrupt_pc );
1.23 + return 1;
1.24 + } else {
1.25 + return 0;
1.26 + }
1.27 +}
1.28 +
1.29 int main()
1.30 {
1.31 -
1.32 + install_interrupt_handler();
1.33 test_add();
1.34 test_addc();
1.35 test_addv();
1.36 test_and();
1.37 test_andi();
1.38 + test_bf();
1.39 + remove_interrupt_handler();
1.40
1.41 fprintf( stderr, "Total: %d/%d tests passed (%d%%)\n", total_tests-total_fails,
1.42 total_tests, ((total_tests-total_fails)*100)/total_tests );
.