view m-toolbox/classes/tests/@Assert/stringEquals.m @ 1:2014ba5b353a database-connection-manager

Remove old code
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Sat, 03 Dec 2011 18:13:55 +0100
parents f0afece42f48
children
line wrap: on
line source

% STRINGEQUALS Assert that two strings are equal.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: Assert that two strings are equal.
%              stringEquals(A, B) throws an AssertionFailed exception if A
%              and B are not equal. A and B must have the same class.
%
% COMMAND:     Assert.stringEquals(val1, val2)
%              Assert.stringEquals(val1, val2, message)
%
% VERSION:     $Id: stringEquals.m,v 1.1 2011/06/20 16:32:56 ingo Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function stringEquals(val1, val2, varargin)
  
  % Check class of the input arguments
  if ~ischar(val1) || ~ischar(val2)
    Assert.fail('The input arguments must be two string.');
  end
  
  if ~strcmp(val1, val2)
    Assert.fail(varargin{:});
  end
  
end