Mercurial > hg > ltpda
diff testing/utp_1.1/generic_utps/utp_68.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 diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_68.m Tue Dec 06 18:42:11 2011 +0100 @@ -0,0 +1,79 @@ +% <TestDescription> +% +% Tests that the constructor properly applies history to the conn+Id constructor. +% +% </TestDescription> +function result = utp_68(cl, obj1, ple3) + + % <SyntaxDescription> + % + % Tests that the constructor properly applies history to the conn+Id + % constructor. + % + % </SyntaxDescription> + + msg = ''; + try + % <SyntaxCode> + pl = plist('hostname', utpGetHostname, ... + 'database', utpGetDatabase, ... + 'username', utpGetUsername, ... + 'password', utpGetPassword, ... + 'experiment title', 'utp_68: submit objects', ... + 'experiment description', 'utp_68: 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) + stest = false; + end + + % <AlgoDescription> + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 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' + if ~strcmp(out.hist.methodInfo.mname, cl) + msg = ['The last step in the history is not ''' cl '''']; + atest = false; + 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 except the additional 'submit' + 'retrieve' steps + if ~eq(out.hist.inhists, obj1.hist) + msg = ['The history of the objects are not equal: ' lastwarn]; + 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_68 \ No newline at end of file