diff testing/utp_1.1/generic_utps/utp_902.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_902.m	Tue Dec 06 18:42:11 2011 +0100
@@ -0,0 +1,57 @@
+% <TestDescription>
+%
+% Tests that the model <MODEL> has a meaningful description.
+%
+% </TestDescription>
+% 
+% $Id: utp_902.m,v 1.3 2010/07/27 07:37:28 hewitson Exp $
+%
+
+function result = utp_902(cl, model_name, pl)
+  
+  % <SyntaxDescription>
+  %
+  % Test that the model <MODEL> has a meaningful description.
+  %
+  % </SyntaxDescription>
+  
+  try
+    
+    % <SyntaxCode>
+    pl  = combine(pl, plist('built-in', model_name));
+    mdl = feval(cl, pl);
+    % </SyntaxCode>
+    stest = true;
+  catch err
+    disp(err.message)
+    msg = [err.message ' - ' err.stack(1).name ' - line ' num2str(err.stack(1).line)];
+    stest = false;
+  end
+  
+  % <AlgoDescription>
+  %
+  % 1) Check that the description of the object is not empty and not equal to 'none'
+  %
+  % </AlgoDescription>
+  
+  atest = true;
+  if stest
+    msg = '';
+    % <AlgoCode>
+    % check we have an ssm model
+    if ~isa(mdl, 'ssm'), atest = false; end
+    % check description is not empty
+    if isempty(mdl.description)
+      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, msg);
+end % END UTP_901
\ No newline at end of file