comparison testing/utp_1.1/generic_utps/check_aop_history.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 %
2 % DESCRIPTION: Generic check for a arithmetic operator unit test which
3 % checks the history for a single inputs.
4 %
5 % CALL: atest = check_aop_history(fcn, in1, in2, out);
6 %
7 % VERSION: $Id: check_aop_history.m,v 1.4 2010/09/24 16:18:16 ingo Exp $
8 %
9
10 function atest = check_aop_history(fcn, in1, in2, out)
11
12 atest = true;
13 % Check the last history step
14 for ii = 1:numel(out)
15 if ~strcmp(out(ii).hist.methodInfo.mname, func2str(fcn)), atest = false; end
16 end
17
18 doCheck = round(rand(1,1)*10);
19 doCheck = 1;
20
21 % Check the rebuild only in 10 percent of the unit test. I do this to
22 % speedup the tests.
23 if doCheck == 1
24 try
25 ple = plist('Exceptions', {'created', 'proctime', 'UUID', 'param/desc', 'name', 'methodInvars', 'version'});
26
27 % Rebuild the output object
28 mout = rebuild(copy(out,1));
29
30 % The rebuilt object must be the same as 'out'
31 for ii=1:numel(mout)
32 if ~eq(mout(ii), out(ii), ple), atest = false; end
33 if atest == 0
34 break;
35 end
36 end
37
38 catch
39 atest = false;
40 end
41 end
42
43 end