Mercurial > hg > ltpda
view testing/utp_1.1/generic_utps/utp_65.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 contructed object can be submitted and retrieved. % % </TestDescription> function result = utp_65(cl, obj1, ple3) % <SyntaxDescription> % % Tests that the contructed object can be submitted and retrieved. % % </SyntaxDescription> msg = ''; try % <SyntaxCode> pl = plist('hostname', utpGetHostname, ... 'database', utpGetDatabase, ... 'username', utpGetUsername, ... 'password', utpGetPassword, ... 'experiment title', 'utp_65: submit objects', ... 'experiment description', 'utp_65: test submission', ... 'analysis description', 'no analysis', ... 'no dialog', true, ... 'use selector', false); ids = submit(obj1, pl); out = feval(cl, plist('hostname', utpGetHostname, ... 'database', utpGetDatabase, ... 'username', utpGetUsername, ... 'password', utpGetPassword, ... 'id', ids)); % </SyntaxCode> stest = true; catch err msg = err.message; disp(err.message) % Close connection stest = false; end % <AlgoDescription> % % 1) Check that the last entry in the history of 'out' corresponds to % the class name. % 2) Check that the 'rebuild' method produces the same object as 'out'. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % Check the last step in the history of 'out' for kk = 1:numel(out) if ~strcmp(out(kk).hist.methodInfo.mname, cl) msg = ['The last step in the history is not ''' cl '''']; atest = false; end end % Check data values if ~eq(out, obj1, ple3) msg = ['The values in the objects are not equal: ' lastwarn]; atest = false; end % Check the history if ~eq(out.hist.inhists, obj1.hist) msg = ['The history of the objects are not equal: ' lastwarn]; atest = false; end % Rebuild the retrieved object % rout = rebuild(out); % if ~eq(rout, out, ple3), 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, msg); end % END UTP_65