Mercurial > hg > ltpda
diff testing/utp_1.1/utps/ssm/utp_ssm_addParameters.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/utps/ssm/utp_ssm_addParameters.m Tue Dec 06 18:42:11 2011 +0100 @@ -0,0 +1,71 @@ +% UTP_SSM_ADDPARAMETERS a set of UTPs for the ssm/addParameters method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ssm_addParameters.m,v 1.1 2009/08/06 16:56:25 hewitson Exp $ +% + +% <MethodDescription> +% +% The addParameters method of the ssm class adds the given parameters to +% the model. +% +% </MethodDescription> + +function results = utp_ssm_addParameters(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ssm'; + mthd = 'addParameters'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test miir objects + [sys1, sys2] = get_test_objects_ssm; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_02(mthd, [sys1 sys2], @algo_test_plist, plist('prop', 2), ple2)]; + results = [results utp_03(mthd, [sys1 sys2 sys1; sys2 sys2 sys1], @algo_test_plist, plist('prop', 2), ple2)]; + results = [results utp_04(mthd, sys1, sys2, sys1, @algo_test_plist, plist('prop', 2), ple2)]; + results = [results utp_04(mthd, sys1, sys2, sys1, @algo_test_param, param('prop', 2), ple2)]; + results = [results utp_05(mthd, sys1, [sys1 sys2 sys1; sys2 sys2 sys1], [sys2 sys1], @algo_test_plist, plist('prop', 2), ple2)]; + results = [results utp_06(mthd, sys1, plist('prop', 2), ple2)]; + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + else + results = 0; + end + else + error('### Incorrect inputs') + end + +end + +function atest = algo_test_plist(in, out, pli) + + atest = true; + if ~eq(out.params.find(pli.params(1).key), pli.params(1).getVal), atest = false; end + +end + + +function atest = algo_test_param(in, out, pli) + + atest = true; + if ~eq(out.params.find(pli(1).key), pli(1).getVal), atest = false; end + +end