Home > freetb4matlab > testfun > assert.m

assert

PURPOSE ^

%

SYNOPSIS ^

function assert (cond, varargin)

DESCRIPTION ^

% -*- texinfo -*-
% @deftypefn {Function File} {} assert (@var{cond})
% @deftypefnx {Function File} {} assert (@var{cond}, @var{errmsg}, @dots{})
% @deftypefnx {Function File} {} assert (@var{cond}, @{var{msg_id}, @var{errmsg}, @dots{})
% @deftypefnx {Function File} {} assert (@var{observed},@var{expected})
% @deftypefnx {Function File} {} assert (@var{observed},@var{expected},@var{tol})
%
% Produces an error if the condition is not met.  @code{assert} can be
% called in three different ways.
%
% @table @code
% @item assert (@var{cond})
% @itemx assert (@var{cond}, @var{errmsg}, @dots{})
% @itemx assert (@var{cond}, @var{msg_id}, @var{errmsg}, @dots{})
% Called with a single argument @var{cond}, @code{assert} produces an
% error if @var{cond} is zero.  If called with a single argument a
% generic error message.  With more than one argument, the additional
% arguments are passed to the @code{error} function.
%
% @item assert (@var{observed}, @var{expected})
% Produce an error if observed is not the same as expected.  Note that 
% observed and expected can be strings, scalars, vectors, matrices, 
% lists or structures.
%
% @item assert(@var{observed}, @var{expected}, @var{tol})
% Accept a tolerance when comparing numbers. 
% If @var{tol} is positive use it as an absolute tolerance, will produce an error if
% @code{abs(@var{observed} - @var{expected}) > abs(@var{tol})}.
% If @var{tol} is negative use it as a relative tolerance, will produce an error if
% @code{abs(@var{observed} - @var{expected}) > abs(@var{tol} * @var{expected})}.
% If @var{expected} is zero @var{tol} will always be used as an absolute tolerance.
% @end table
% @seealso{test}
% @end deftypefn

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Fri 22-May-2009 15:13:00 by m2html © 2003