📄 t_ok.m
字号:
function t_ok(cond, msg)%T_OK Tests if a condition is true.% t_ok(expr, msg) increments the global test count and if the expr% is true it increments the passed tests count, otherwise increments% the failed tests count. Prints 'ok' or 'not ok' followed by the% msg, unless the global variable t_quiet is true. Intended to be% called between calls to t_begin and t_end.% MATPOWER% $Id: t_ok.m,v 1.2 2004/08/23 20:59:48 ray Exp $% by Ray Zimmerman, PSERC Cornell% Copyright (c) 2004 by Power System Engineering Research Center (PSERC)% See http://www.pserc.cornell.edu/matpower/ for more info.global t_quiet;global t_counter;global t_ok_cnt;global t_not_ok_cnt;if nargin < 2 | strcmp(msg, '') msg = '';else msg = [' - ', msg];endif cond t_ok_cnt = t_ok_cnt + 1;else t_not_ok_cnt = t_not_ok_cnt + 1; if ~t_quiet fprintf('not '); endendif ~t_quiet fprintf('ok %d%s\n', t_counter, msg);endt_counter = t_counter + 1;return;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -