comparison 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
comparison
equal deleted inserted replaced
43:bc767aaa99a8 44:409a22968d5e
1
2 % <TestDescription>
3 %
4 % Test that the <METHOD> method uses the plist to get the axis. This is
5 % intended to test methods like ao/max and ao/min which only allow 'x' and
6 % 'y' choices.
7 %
8 % </TestDescription>
9 function result = utp_208(method, obj1, ple1)
10
11 % <SyntaxDescription>
12 %
13 % Test that the <METHOD> method uses the plist to get the axis.
14 %
15 % </SyntaxDescription>
16
17 try
18 % <SyntaxCode>
19 plx = plist('axis', 'X');
20 ply = plist('axis', 'Y');
21 out1 = feval(method, obj1, plx);
22 out2 = feval(method, obj1, ply);
23 mout1 = rebuild(out1);
24 mout2 = rebuild(out2);
25 % </SyntaxCode>
26 stest = true;
27 catch err
28 disp(err.message)
29 stest = false;
30 end
31
32 % <AlgoDescription>
33 %
34 % 1) Check that the <METHOD> method applies to the x-axis
35 % 2) Check that the <METHOD> method applies to the y-axis
36 % 3) Check that the <METHOD> method applies to both axes
37 % 4) Check that the re-built object is the same as in 'out[1..3]'.
38 %
39 % </AlgoDescription>
40
41 atest = true;
42 if stest
43 % <AlgoCode>
44 % Check each output against the correct values
45 if ~isequal(feval(method,obj1.data.getX), out1.data.getX), atest = false; end
46 if ~isequal(feval(method,obj1.data.getY), out2.data.getY), atest = false; end
47 % Check the re-built objects
48 if ~eq(mout1, out1, ple1), atest = false; end
49 if ~eq(mout2, out2, ple1), atest = false; end
50 % </AlgoCode>
51 else
52 atest = false;
53 end
54
55 % Return a result structure
56 dd = dbstack;
57 mfilename = dd(2).file(1:end-2);
58 result = utp_prepare_result(atest, stest, dbstack, mfilename);
59 end % END UTP_208