view m-toolbox/classes/tests/@Assert/objectEquals.m @ 52:daf4eab1a51e
database-connection-manager tip
Fix. Default password should be [] not an empty string
author
Daniele Nicolodi <nicolodi@science.unitn.it>
date
Wed, 07 Dec 2011 17:29:47 +0100 (2011-12-07)
parents
f0afece42f48
children
line source
+ − % OBJECTEQUALS Assert that two ltpda_obj objects are equal.
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − %
+ − % DESCRIPTION: Assert that two ltpda_obj objects are equal.
+ − % objectEquals(A, B) throws an AssertionFailed exception if A
+ − % and B are not equal. A and B must have the same class and
+ − % the same length.
+ − %
+ − % COMMAND: Assert.objectEquals(val1, val2)
+ − % Assert.objectEquals(val1, val2, message)
+ − %
+ − % VERSION: $Id: objectEquals.m,v 1.1 2011/06/20 16:32:56 ingo Exp $
+ − %
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − function objectEquals(val1, val2, varargin)
+ −
+ − % Check class of the input arguments
+ − if ~strcmp(class(val1), class(val2))
+ − Assert.fail('The input arguments must be from the same class.');
+ − end
+ −
+ − % Check class of the input arguments
+ − if ~isa(val1, 'ltpda_obj')
+ − Assert.fail('The input arguments must be derived from the ltpda_obj class.');
+ − end
+ −
+ − % Check the length of the inputs
+ − if numel(val1) ~= numel(val2)
+ − Assert.fail('The input arguments don''t have the same length.');
+ − end
+ −
+ − if ~eq(val1, val2)
+ − Assert.fail(varargin{:});
+ − end
+ −
+ − end