Home > matpower7.0 > mptest > lib > t_begin.m

t_begin

PURPOSE ^

T_BEGIN Begin running tests.

SYNOPSIS ^

function t_begin(num_of_tests, quiet)

DESCRIPTION ^

T_BEGIN  Begin running tests.
   T_BEGIN(NUM_OF_TESTS, QUIET) initializes the global test counters,
   setting everything up to execute NUM_OF_TESTS tests using T_OK
   and T_IS. If QUIET is true, it will not print anything for the
   individual tests, only a summary when T_END is called.

   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_END, 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_begin(num_of_tests, quiet)
0002 %T_BEGIN  Begin running tests.
0003 %   T_BEGIN(NUM_OF_TESTS, QUIET) initializes the global test counters,
0004 %   setting everything up to execute NUM_OF_TESTS tests using T_OK
0005 %   and T_IS. If QUIET is true, it will not print anything for the
0006 %   individual tests, only a summary when T_END is called.
0007 %
0008 %   Example:
0009 %       quiet = 0;
0010 %       t_begin(5, quiet);
0011 %       t_ok(pi > 3, 'size of pi');
0012 %       t_skip(3, 'not yet written');
0013 %       t_is(2+2, 4, 12, '2+2 still equals 4');
0014 %       t_end;
0015 %
0016 %   See also T_END, T_OK, T_IS, T_SKIP, T_RUN_TESTS.
0017 
0018 %   MP-Test
0019 %   Copyright (c) 2004-2016, Power Systems Engineering Research Center (PSERC)
0020 %   by Ray Zimmerman, PSERC Cornell
0021 %
0022 %   This file is part of MP-Test.
0023 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0024 %   See https://github.com/MATPOWER/mptest 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 if nargin < 2
0035     quiet = 0;
0036 end
0037 
0038 t_quiet = quiet;
0039 t_num_of_tests = num_of_tests;
0040 t_counter = 1;
0041 t_ok_cnt = 0;
0042 t_not_ok_cnt = 0;
0043 t_skip_cnt = 0;
0044 t_clock = tic;
0045 
0046 if ~t_quiet
0047     fprintf('1..%d\n', num_of_tests);
0048 end

Generated on Mon 24-Jun-2019 15:58:45 by m2html © 2005