Home > matpower4.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 %   $Id: t_end.m,v 1.9 2010/04/26 19:45:26 ray Exp $
0018 %   by Ray Zimmerman, PSERC Cornell
0019 %   Copyright (c) 2004-2010 by Power System Engineering Research Center (PSERC)
0020 %
0021 %   This file is part of MATPOWER.
0022 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0023 %
0024 %   MATPOWER is free software: you can redistribute it and/or modify
0025 %   it under the terms of the GNU General Public License as published
0026 %   by the Free Software Foundation, either version 3 of the License,
0027 %   or (at your option) any later version.
0028 %
0029 %   MATPOWER is distributed in the hope that it will be useful,
0030 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0031 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0032 %   GNU General Public License for more details.
0033 %
0034 %   You should have received a copy of the GNU General Public License
0035 %   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.
0036 %
0037 %   Additional permission under GNU GPL version 3 section 7
0038 %
0039 %   If you modify MATPOWER, or any covered work, to interface with
0040 %   other modules (such as MATLAB code and MEX-files) available in a
0041 %   MATLAB(R) or comparable environment containing parts covered
0042 %   under other licensing terms, the licensors of MATPOWER grant
0043 %   you additional permission to convey the resulting work.
0044 
0045 global t_quiet;
0046 global t_num_of_tests;
0047 global t_counter;
0048 global t_ok_cnt;
0049 global t_not_ok_cnt;
0050 global t_skip_cnt;
0051 global t_clock;
0052 
0053 t_counter = t_counter - 1;
0054 
0055 if t_counter == t_num_of_tests && ...
0056         t_counter == t_ok_cnt + t_skip_cnt && ...
0057         t_not_ok_cnt == 0
0058     all_ok = 1;
0059 else
0060     all_ok = 0;
0061 end
0062 
0063 if t_quiet
0064     if all_ok
0065         fprintf('ok');
0066         if t_skip_cnt
0067             fprintf(' (%d of %d skipped)', t_skip_cnt, t_num_of_tests);
0068         end
0069     else
0070         fprintf('not ok\n');
0071         fprintf('\t#####  Ran %d of %d tests: %d passed, %d failed', ...
0072             t_counter, t_num_of_tests, t_ok_cnt, t_not_ok_cnt);
0073         if t_skip_cnt
0074             fprintf(', %d skipped', t_skip_cnt);
0075         end
0076     end
0077     fprintf('\n');
0078 else
0079     if all_ok
0080         if t_skip_cnt
0081             fprintf('All tests successful (%d passed, %d skipped of %d)', ...
0082                 t_ok_cnt, t_skip_cnt, t_num_of_tests);
0083         else
0084             fprintf('All tests successful (%d of %d)', t_ok_cnt, t_num_of_tests);
0085         end
0086     else
0087         fprintf('Ran %d of %d tests: %d passed, %d failed', ...
0088             t_counter, t_num_of_tests, t_ok_cnt, t_not_ok_cnt);
0089         if t_skip_cnt
0090             fprintf(', %d skipped', t_skip_cnt);
0091         end
0092     end
0093     fprintf('\nElapsed time %.2f seconds.\n', etime(clock, t_clock));
0094 end

Generated on Mon 26-Jan-2015 15:00:13 by m2html © 2005