Mercurial > hg > ltpda
view testing/utp_1.1/generic_utps/utp_208.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> % % Test that the <METHOD> method uses the plist to get the axis. This is % intended to test methods like ao/max and ao/min which only allow 'x' and % 'y' choices. % % </TestDescription> function result = utp_208(method, obj1, ple1) % <SyntaxDescription> % % Test that the <METHOD> method uses the plist to get the axis. % % </SyntaxDescription> try % <SyntaxCode> plx = plist('axis', 'X'); ply = plist('axis', 'Y'); out1 = feval(method, obj1, plx); out2 = feval(method, obj1, ply); mout1 = rebuild(out1); mout2 = rebuild(out2); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 1) Check that the <METHOD> method applies to the x-axis % 2) Check that the <METHOD> method applies to the y-axis % 3) Check that the <METHOD> method applies to both axes % 4) Check that the re-built object is the same as in 'out[1..3]'. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % Check each output against the correct values if ~isequal(feval(method,obj1.data.getX), out1.data.getX), atest = false; end if ~isequal(feval(method,obj1.data.getY), out2.data.getY), atest = false; end % Check the re-built objects if ~eq(mout1, out1, ple1), atest = false; end if ~eq(mout2, out2, ple1), 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_208