comparison m-toolbox/classes/tests/@Assert/true.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % TRUE Assert that a condition is true.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: Assert that a condition is true.
5 % true(A, B) throws an AssertionFailed exception if A is not
6 % true.
7 %
8 % COMMAND: Assert.true(condition)
9 % Assert.true(condition, message)
10 %
11 % VERSION: $Id: true.m,v 1.1 2011/06/20 16:32:56 ingo Exp $
12 %
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 function true(val, varargin)
15
16 % Check class of the input argument
17 if ~islogical(val)
18 Assert.fail('The condition input arguments must be two double.');
19 end
20
21 % Check condition
22 if ~val
23 Assert.fail(varargin{:});
24 end
25
26 end