0001 function t_end
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 global t_quiet;
0025 global t_num_of_tests;
0026 global t_counter;
0027 global t_ok_cnt;
0028 global t_not_ok_cnt;
0029 global t_skip_cnt;
0030 global t_clock;
0031
0032 t_counter = t_counter - 1;
0033
0034 if t_counter == t_num_of_tests && ...
0035 t_counter == t_ok_cnt + t_skip_cnt && ...
0036 t_not_ok_cnt == 0
0037 all_ok = 1;
0038 else
0039 all_ok = 0;
0040 end
0041
0042 if t_quiet
0043 if all_ok
0044 fprintf('ok');
0045 if t_skip_cnt
0046 fprintf(' (%d of %d skipped)', t_skip_cnt, t_num_of_tests);
0047 end
0048 else
0049 fprintf('not ok\n');
0050 fprintf('\t##### Ran %d of %d tests: %d passed, %d failed', ...
0051 t_counter, t_num_of_tests, t_ok_cnt, t_not_ok_cnt);
0052 if t_skip_cnt
0053 fprintf(', %d skipped', t_skip_cnt);
0054 end
0055 end
0056 fprintf('\n');
0057 else
0058 if all_ok
0059 if t_skip_cnt
0060 fprintf('All tests successful (%d passed, %d skipped of %d)', ...
0061 t_ok_cnt, t_skip_cnt, t_num_of_tests);
0062 else
0063 fprintf('All tests successful (%d of %d)', t_ok_cnt, t_num_of_tests);
0064 end
0065 else
0066 fprintf('Ran %d of %d tests: %d passed, %d failed', ...
0067 t_counter, t_num_of_tests, t_ok_cnt, t_not_ok_cnt);
0068 if t_skip_cnt
0069 fprintf(', %d skipped', t_skip_cnt);
0070 end
0071 end
0072 fprintf('\nElapsed time %.2f seconds.\n', toc(t_clock));
0073 end