diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testing/utp_1.1/generic_utps/utp_66.m	Tue Dec 06 18:42:11 2011 +0100
@@ -0,0 +1,59 @@
+% <TestDescription>
+%
+% Tests that the construuctor properly works with the plist(pzmodel)
+% constructor.
+%
+% </TestDescription>
+function result = utp_66(cl, ple1)
+  
+  % <SyntaxDescription>
+  %
+  % Tests that the constructor properly works with the plist(pzmodel)
+  % constructor.
+  %
+  % </SyntaxDescription>
+  
+  try
+    % <SyntaxCode>
+    ps   = [pz(1) pz(200)];
+    zs   = pz(50);
+    pzm  = pzmodel(1, ps, zs, unit('Hz'), unit('V'));
+    pl   = plist('pzmodel', pzm, 'fs', 10, 'nsecs', 10);
+    out   = feval(cl, pl);
+    
+    rout = rebuild(out);
+    % </SyntaxCode>
+    stest = true;
+  catch err
+    disp(err.message)
+    stest = false;
+  end
+  
+  % <AlgoDescription>
+  %
+  % 1) Check that the last entry in the history of 'out' corresponds to
+  %    'ssm'.
+  % 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), atest = false; end
+    % Check the next to the last step in the history.
+    % It must be the history of the pole/zero model (here 'pzmodel')
+    if ~strcmp(out.hist.inhists.methodInfo.mname, 'pzmodel'), atest = false; end
+    % Rebuild object and check the result
+    if ~eq(rout, out, 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_66
\ No newline at end of file