comparison m-toolbox/classes/tests/@Assert/stringEquals.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 % STRINGEQUALS Assert that two strings are equal.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: Assert that two strings are equal.
5 % stringEquals(A, B) throws an AssertionFailed exception if A
6 % and B are not equal. A and B must have the same class.
7 %
8 % COMMAND: Assert.stringEquals(val1, val2)
9 % Assert.stringEquals(val1, val2, message)
10 %
11 % VERSION: $Id: stringEquals.m,v 1.1 2011/06/20 16:32:56 ingo Exp $
12 %
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 function stringEquals(val1, val2, varargin)
15
16 % Check class of the input arguments
17 if ~ischar(val1) || ~ischar(val2)
18 Assert.fail('The input arguments must be two string.');
19 end
20
21 if ~strcmp(val1, val2)
22 Assert.fail(varargin{:});
23 end
24
25 end