view m-toolbox/classes/tests/@Assert/true.m @ 44:409a22968d5e default

Add unit tests
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 18:42:11 +0100
parents f0afece42f48
children
line wrap: on
line source

% 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