Mercurial > hg > ltpda
comparison testing/utp_1.1/generic_utps/utp_06.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 % <TestDescription> | |
2 % | |
3 % Tests that the <METHOD> method properly applies history. | |
4 % | |
5 % </TestDescription> | |
6 function result = utp_06(method, obj1, pli, epl) | |
7 | |
8 % <SyntaxDescription> | |
9 % | |
10 % Test that the result of applying the <METHOD> method can be processed back. | |
11 % | |
12 % </SyntaxDescription> | |
13 | |
14 try | |
15 % <SyntaxCode> | |
16 if isempty(pli) | |
17 out = feval(method, obj1); | |
18 else | |
19 out = feval(method, obj1, pli); | |
20 end | |
21 mout = rebuild(out); | |
22 % </SyntaxCode> | |
23 stest = true; | |
24 catch err | |
25 disp(err.message) | |
26 stest = false; | |
27 end | |
28 | |
29 % <AlgoDescription> | |
30 % | |
31 % 1) Check that the last entry in the history of 'out' corresponds to | |
32 % '<METHOD>'. | |
33 % 2) Check that the re-built object is the same object as the input. | |
34 % | |
35 % </AlgoDescription> | |
36 | |
37 atest = true; | |
38 if stest | |
39 % <AlgoCode> | |
40 % Check the last step in the history of 'out' | |
41 if ~strcmp(out.hist.methodInfo.mname, method), atest = false; end | |
42 % The rebuilt object must be the same as 'out' | |
43 if ~eq(mout, out, epl), atest = false; end | |
44 % </AlgoCode> | |
45 else | |
46 atest = false; | |
47 end | |
48 | |
49 % Return a result structure | |
50 dd = dbstack; | |
51 mfilename = dd(2).file(1:end-2); | |
52 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
53 end % END UTP_06 |