Mercurial > hg > ltpda
view testing/utp_1.1/generic_utps/utp_genericModify.m @ 50:7d2e2e065cf1 database-connection-manager
Update unit tests
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 07 Dec 2011 17:24:37 +0100 |
parents | 409a22968d5e |
children |
line wrap: on
line source
% <TestDescription> % % Tests that the <METHOD> method can modify the input AO. % % </TestDescription> function result = utp_genericModify(method, obj, args, algo, ple) % <SyntaxDescription> % % Test that the <METHOD> method can modify the input object by calling % with no output and that the method doesn't change the input of the % function notation (with a equal sign). % % </SyntaxDescription> try % <SyntaxCode> obj_modi = copy(obj,1); obj_eq = copy(obj,1); if iscell(args) out = feval(method, obj_eq, args{:}); feval(method, obj_modi, args{:}); else out = feval(method, obj_eq, args); feval(method, obj_modi, args); end % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 1) Check that the modified input is changed by the method % 2) Check that 'out' and 'obj_eq' are now different. % 3) Check that 'obj_eq' is not changed % 4) Check that out and amodi are the same % % </AlgoDescription> atest = true; if stest % <AlgoCode> % Check that obj_modi is changed atest = algo(obj, obj_modi, 1, args); % Check that 'out' and 'obj_eq' are now different. if eq(out, obj_eq, ple), atest = false; end % Check that 'obj_eq' is not changed if ~eq(obj_eq, obj, ple), atest = false; end % Check that out and obj_modi are the same if ~eq(out, obj_modi, ple), atest = false; end % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, ['utp_' class(obj) '_' method]); end