Mercurial > hg > ltpda
comparison testing/utp_1.1/generic_utps/utp_genericSet_minfo.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 % UTP_GENERICSET_MINFO a set of UTPs for a general setter method | |
2 % | |
3 % M Hewitson 06-08-08 | |
4 % | |
5 % $Id: utp_genericSet_minfo.m,v 1.1 2010/02/08 19:26:41 ingo Exp $ | |
6 % | |
7 | |
8 % <TestDescription> | |
9 % | |
10 % Tests that the getInfo call works for this a general setter method. | |
11 % | |
12 % </TestDescription> | |
13 | |
14 function result = utp_genericSet_minfo(method, objs, prop, algoTests) | |
15 | |
16 % <SyntaxDescription> | |
17 % | |
18 % Test that the getInfo call works for no sets, all sets, and each set | |
19 % individually. | |
20 % | |
21 % </SyntaxDescription> | |
22 | |
23 try | |
24 % <SyntaxCode> | |
25 % Call for no sets | |
26 io(1) = eval([class(objs) '.getInfo(''' method ''', ''None'')']); | |
27 % Call for all sets | |
28 io(2) = eval([class(objs) '.getInfo(''' method ''')']); | |
29 % Call for each set | |
30 for kk=1:numel(io(2).sets) | |
31 io(kk+2) = eval([class(objs) '.getInfo(''' method ''', ''' io(2).sets{kk} ''')']); | |
32 end | |
33 % </SyntaxCode> | |
34 stest = true; | |
35 catch err | |
36 disp(err.message) | |
37 stest = false; | |
38 end | |
39 | |
40 % <AlgoDescription> | |
41 % | |
42 % 1) Check that getInfo call returned an minfo object in all cases. | |
43 % 2) Check that all plists have the correct parameters. | |
44 % | |
45 % </AlgoDescription> | |
46 | |
47 atest = true; | |
48 if stest | |
49 % <AlgoCode> | |
50 % check we have minfo objects | |
51 if isa(io, 'minfo') | |
52 %%% SET 'None' | |
53 if ~isempty(io(1).sets), atest = false; end | |
54 if ~isempty(io(1).plists), atest = false; end | |
55 %%% Check all Sets | |
56 if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end | |
57 if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end | |
58 %%%%%%%%%% SET 'Default' | |
59 if io(3).plists.nparams < 1, atest = false; end | |
60 % Check key | |
61 if ~io(3).plists.isparam(prop), atest = false; end | |
62 % Check default value | |
63 if ~algoTests(io(3).plists.find(prop)), atest = false; end | |
64 end | |
65 % </AlgoCode> | |
66 else | |
67 atest = false; | |
68 end | |
69 | |
70 % Return a result structure | |
71 result = utp_prepare_result(atest, stest, dbstack, ['utp_' class(objs) '_' method]); | |
72 end | |
73 | |
74 |