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.
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 % MATPOWER 0019 % Copyright (c) 2004-2015 by Power System Engineering Research Center (PSERC) 0020 % by Ray Zimmerman, PSERC Cornell 0021 % 0022 % $Id: t_begin.m 2644 2015-03-11 19:34:22Z ray $ 0023 % 0024 % This file is part of MATPOWER. 0025 % Covered by the 3-clause BSD License (see LICENSE file for details). 0026 % See http://www.pserc.cornell.edu/matpower/ for more info. 0027 0028 global t_quiet; 0029 global t_num_of_tests; 0030 global t_counter; 0031 global t_ok_cnt; 0032 global t_not_ok_cnt; 0033 global t_skip_cnt; 0034 global t_clock; 0035 0036 if nargin < 2 0037 quiet = 0; 0038 end 0039 0040 t_quiet = quiet; 0041 t_num_of_tests = num_of_tests; 0042 t_counter = 1; 0043 t_ok_cnt = 0; 0044 t_not_ok_cnt = 0; 0045 t_skip_cnt = 0; 0046 t_clock = clock; 0047 0048 if ~t_quiet 0049 fprintf('1..%d\n', num_of_tests); 0050 end