Home > matpower5.1 > 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-2015 by Power System Engineering Research Center (PSERC)
0018 %   by Ray Zimmerman, PSERC Cornell
0019 %
0020 %   $Id: t_end.m 2644 2015-03-11 19:34:22Z ray $
0021 %
0022 %   This file is part of MATPOWER.
0023 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0024 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0025 
0026 global t_quiet;
0027 global t_num_of_tests;
0028 global t_counter;
0029 global t_ok_cnt;
0030 global t_not_ok_cnt;
0031 global t_skip_cnt;
0032 global t_clock;
0033 
0034 t_counter = t_counter - 1;
0035 
0036 if t_counter == t_num_of_tests && ...
0037         t_counter == t_ok_cnt + t_skip_cnt && ...
0038         t_not_ok_cnt == 0
0039     all_ok = 1;
0040 else
0041     all_ok = 0;
0042 end
0043 
0044 if t_quiet
0045     if all_ok
0046         fprintf('ok');
0047         if t_skip_cnt
0048             fprintf(' (%d of %d skipped)', t_skip_cnt, t_num_of_tests);
0049         end
0050     else
0051         fprintf('not ok\n');
0052         fprintf('\t#####  Ran %d of %d tests: %d passed, %d failed', ...
0053             t_counter, t_num_of_tests, t_ok_cnt, t_not_ok_cnt);
0054         if t_skip_cnt
0055             fprintf(', %d skipped', t_skip_cnt);
0056         end
0057     end
0058     fprintf('\n');
0059 else
0060     if all_ok
0061         if t_skip_cnt
0062             fprintf('All tests successful (%d passed, %d skipped of %d)', ...
0063                 t_ok_cnt, t_skip_cnt, t_num_of_tests);
0064         else
0065             fprintf('All tests successful (%d of %d)', t_ok_cnt, t_num_of_tests);
0066         end
0067     else
0068         fprintf('Ran %d of %d tests: %d passed, %d failed', ...
0069             t_counter, t_num_of_tests, t_ok_cnt, t_not_ok_cnt);
0070         if t_skip_cnt
0071             fprintf(', %d skipped', t_skip_cnt);
0072         end
0073     end
0074     fprintf('\nElapsed time %.2f seconds.\n', etime(clock, t_clock));
0075 end

Generated on Fri 20-Mar-2015 18:23:34 by m2html © 2005