Code covered by the BSD License  

Highlights from
MATLAB xUnit Test Framework

image thumbnail

MATLAB xUnit Test Framework


Steve Eddins (view profile)


31 Jan 2009 (Updated )

MATLAB xUnit is a unit test framework for MATLAB code.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

assertFalse(condition, message)
function assertFalse(condition, message)
%assertFalse Assert that input condition is false
%   assertFalse(CONDITION, MESSAGE) throws an exception containing the string
%   MESSAGE if CONDITION is not false.
%   MESSAGE is optional.
%   Examples
%   --------
%   assertFalse(isreal(sqrt(-1)))
%   assertFalse(isreal(sqrt(-1)), ...
%       'Expected isreal(sqrt(-1)) to be false.')
%   See also assertTrue

%   Steven L. Eddins
%   Copyright 2008-2010 The MathWorks, Inc.

if nargin < 2
   message = 'Asserted condition is not false.';

if ~isscalar(condition) || ~islogical(condition)
   throwAsCaller(MException('assertFalse:invalidCondition', ...
      'CONDITION must be a scalar logical value.'));

if condition
   throwAsCaller(MException('assertFalse:trueCondition', '%s', message));

Contact us