6 int test_print_result( char *testname, int failed, int total )
8 fprintf( stdout, "%s: %d/%d tests passed\n", testname, total-failed, total );
10 total_fails += failed;
14 void test_print_failure( char *testname, int number, char *message )
16 if( message == NULL ) {
17 fprintf( stderr, "%s: Test %d failed!\n", testname, number );
19 fprintf( stderr, "%s: Test %d failed: %s\n", testname, number, message );
23 extern unsigned int interrupt_pc;
24 extern unsigned int interrupt_count;
26 int assert_exception_caught( char *testname, int number, unsigned int expectedpc )
28 if( interrupt_count == 0 ) {
29 fprintf( stderr, "%s: Test %d failed: Expected exception not delivered\n",
32 } else if( interrupt_count != 1 ) {
33 fprintf( stderr, "%s: Test %d failed: Expected exception delivered %d times!\n",
34 testname, number, interrupt_count );
36 } else if( interrupt_pc != expectedpc ) {
37 fprintf( stderr, "%s: Test %d failed: Expected exception at PC %08X, but was %08X\n",
38 testname, number, expectedpc, interrupt_pc );
47 fprintf( stdout, "Instruction tests...\n" );
48 install_interrupt_handler();
72 fprintf( stdout, "--> %d/%d instruction tests passed (%d%%)\n\n",
73 total_tests-total_fails, total_tests,
74 ((total_tests-total_fails)*100)/total_tests );
76 fprintf( stdout, "Exception tests...\n" );
79 remove_interrupt_handler();
81 fprintf( stdout, "Total: %d/%d tests passed (%d%%)\n", total_tests-total_fails,
82 total_tests, ((total_tests-total_fails)*100)/total_tests );
.