Mercurial > hg > ltpda
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/tests/@Assert/true.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,26 @@ +% TRUE Assert that a condition is true. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: Assert that a condition is true. +% true(A, B) throws an AssertionFailed exception if A is not +% true. +% +% COMMAND: Assert.true(condition) +% Assert.true(condition, message) +% +% VERSION: $Id: true.m,v 1.1 2011/06/20 16:32:56 ingo Exp $ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function true(val, varargin) + + % Check class of the input argument + if ~islogical(val) + Assert.fail('The condition input arguments must be two double.'); + end + + % Check condition + if ~val + Assert.fail(varargin{:}); + end + +end