Mercurial > hg > ltpda
comparison m-toolbox/classes/tests/@Assert/doubleEquals.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 % DOUBLEEQUALS Assert that two doubles are equal. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: Assert that two doubles are equal. | |
5 % doubleEquals(A, B) throws an AssertionFailed exception if A | |
6 % and B are not equal. A and B must have the same class and | |
7 % the same length. | |
8 % | |
9 % COMMAND: Assert.doubleEquals(val1, val2) | |
10 % Assert.doubleEquals(val1, val2, message) | |
11 % | |
12 % VERSION: $Id: doubleEquals.m,v 1.1 2011/06/20 16:32:56 ingo Exp $ | |
13 % | |
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
15 function doubleEquals(val1, val2, varargin) | |
16 | |
17 % Check class of the input arguments | |
18 if ~isnumeric(val1) || ~isnumeric(val2) | |
19 Assert.fail('The input arguments must be two double.'); | |
20 end | |
21 | |
22 % Check the length of the inputs | |
23 if numel(val1) ~= numel(val2) | |
24 Assert.fail('The input arguments don''t have the same length.'); | |
25 end | |
26 | |
27 if (val1 ~= val2) | |
28 Assert.fail(varargin{:}); | |
29 end | |
30 | |
31 end |