Mercurial > hg > ltpda
view testing/utp_1.1/generic_utps/utp_69.m @ 44:409a22968d5e default
Add unit tests
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Tue, 06 Dec 2011 18:42:11 +0100 |
parents | |
children |
line wrap: on
line source
% <TestDescription> % % Tests that the copy method works with a single object as an input. % % </TestDescription> function result = utp_69(cl, n, m, ple) % <SyntaxDescription> % % Test the positive (copy-case) and the negative (non copy-case) case. % % </SyntaxDescription> try % <SyntaxCode> tt1 = eval(sprintf('%s.initObjectWithSize(%d,%d)', cl, n, m)); % non copy-case out1 = copy(tt1, 0); out1.setName('new name'); % copy-case tt2 = eval(sprintf('%s.initObjectWithSize(%d,%d)', cl, n, m)); out2 = copy(tt2, 1); out2.setName('new name'); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 1) Check that the output is a 'real' copy or only a copy of the handle % % </AlgoDescription> atest = true; if stest % <AlgoCode> % It must be a copy of the handle -> The changes to the output appears to % the input if ~eq(out1, tt1), atest = false; end % This is a 'real' copy -> The changes to the output doesn't appear to % the input if eq(out2, tt2), atest = false; end % The output must be the same as the other output except the changed % property if ~eq(out1, out2, ple), atest = false; end % </AlgoCode> else atest = false; end % Return a result structure dd = dbstack; mfilename = dd(2).file(1:end-2); result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_69