Home > matpower6.0 > t > t_end.m

t_end

PURPOSE ^

T_END Finish running tests and print statistics.

SYNOPSIS ^

function t_end

DESCRIPTION ^

T_END  Finish running tests and print statistics.
   T_END checks the global counters that were updated by calls to
   T_OK and T_IS and prints out a summary of the test results.

   Example:
       quiet = 0;
       t_begin(5, quiet);
       t_ok(pi > 3, 'size of pi');
       t_skip(3, 'not yet written');
       t_is(2+2, 4, 12, '2+2 still equals 4');
       t_end;

   See also T_BEGIN, T_OK, T_IS, T_SKIP, T_RUN_TESTS.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function t_end
0002 %T_END  Finish running tests and print statistics.
0003 %   T_END checks the global counters that were updated by calls to
0004 %   T_OK and T_IS and prints out a summary of the test results.
0005 %
0006 %   Example:
0007 %       quiet = 0;
0008 %       t_begin(5, quiet);
0009 %       t_ok(pi > 3, 'size of pi');
0010 %       t_skip(3, 'not yet written');
0011 %       t_is(2+2, 4, 12, '2+2 still equals 4');
0012 %       t_end;
0013 %
0014 %   See also T_BEGIN, T_OK, T_IS, T_SKIP, T_RUN_TESTS.
0015 
0016 %   MATPOWER
0017 %   Copyright (c) 2004-2016, Power Systems Engineering Research Center (PSERC)
0018 %   by Ray Zimmerman, PSERC Cornell
0019 %
0020 %   This file is part of MATPOWER.
0021 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0022 %   See http://www.pserc.cornell.edu/matpower/ for more info.
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', etime(clock, t_clock));
0073 end

Generated on Fri 16-Dec-2016 12:45:37 by m2html © 2005