[b4b313]: / matlab_xunit_3.1 / matlab_xunit / xunit / assertFalse.m

Download this file

32 lines (27 with data), 841 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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.';
end
if ~isscalar(condition) || ~islogical(condition)
throwAsCaller(MException('assertFalse:invalidCondition', ...
'CONDITION must be a scalar logical value.'));
end
if condition
throwAsCaller(MException('assertFalse:trueCondition', '%s', message));
end