Mercurial > hg > ltpda
comparison testing/utp_1.1/generic_utps/utp_66.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 construuctor properly works with the plist(pzmodel) | |
4 % constructor. | |
5 % | |
6 % </TestDescription> | |
7 function result = utp_66(cl, ple1) | |
8 | |
9 % <SyntaxDescription> | |
10 % | |
11 % Tests that the constructor properly works with the plist(pzmodel) | |
12 % constructor. | |
13 % | |
14 % </SyntaxDescription> | |
15 | |
16 try | |
17 % <SyntaxCode> | |
18 ps = [pz(1) pz(200)]; | |
19 zs = pz(50); | |
20 pzm = pzmodel(1, ps, zs, unit('Hz'), unit('V')); | |
21 pl = plist('pzmodel', pzm, 'fs', 10, 'nsecs', 10); | |
22 out = feval(cl, pl); | |
23 | |
24 rout = rebuild(out); | |
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 last entry in the history of 'out' corresponds to | |
35 % 'ssm'. | |
36 % 2) Check that the 'rebuild' method produces the same object as 'out'. | |
37 % | |
38 % </AlgoDescription> | |
39 | |
40 atest = true; | |
41 if stest | |
42 % <AlgoCode> | |
43 % Check the last step in the history of 'out' | |
44 if ~strcmp(out.hist.methodInfo.mname, cl), atest = false; end | |
45 % Check the next to the last step in the history. | |
46 % It must be the history of the pole/zero model (here 'pzmodel') | |
47 if ~strcmp(out.hist.inhists.methodInfo.mname, 'pzmodel'), atest = false; end | |
48 % Rebuild object and check the result | |
49 if ~eq(rout, out, 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_66 |