Mercurial > hg > ltpda
view testing/utp_1.1/generic_utps/utp_70.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 constructor properly applies history to the % plist(<plist-object>) constructor. % % </TestDescription> function result = utp_70(cl, obj1, ple2) % <SyntaxDescription> % % Test that the output can be processed back with the rebuild method. % % </SyntaxDescription> try % <SyntaxCode> % Store the object filename = sprintf('%s.xml', cl); save(obj1, filename); pl = plist('filename', filename); out1 = feval(cl, plist('plist', pl)); out2 = feval(cl, plist('plist', plist())); % empty plist rout1 = rebuild(out1); rout2 = rebuild(out2); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 1) Check that the 'rebuild' method produces the same object as 'out'. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % Check that the constructor pass the inner plist to the same constructor if ~eq(out1, obj1), atest = false; end % The second output must be an empty object. if ~eq(out2, feval(cl), ple2), atest = false; end % Rebuild object and check the result if ~eq(rout1, out1, ple2), atest = false; end if ~eq(rout2, out2, ple2), atest = false; end % </AlgoCode> delete(filename); else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_70