function unit_results()
  ## Print the results from previous unittest calls in pretty format.
  
  global unittest_results;
  
  printf("\n");
  printf("# of testcases attempted   %d\n", unittest_results.total);
  printf("# of expected passes       %d\n", unittest_results.pass);
  printf("# of expected failures     %d\n", unittest_results.xfail);
  printf("# of unexpected passes     %d\n", unittest_results.upass);
  printf("# of unexpected failures   %d\n", unittest_results.fail);
  printf("# of unresolved testcases  %d\n", unittest_results.unresolved);
  printf("\n");
  
  if (unittest_results.total == unittest_results.pass + unittest_results.xfail)
    printf("Unit testing completed successfully!\n");
  else
    printf("One or more tests failed!\n");
  endif
endfunction
