comparison testing/utp_1.1/generic_utps/check_aop_data_object.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 datatype for a single inputs.
4 %
5 % CALL: atest = check_aop_data_object(fcn, in1, in2, out);
6 %
7 % VERSION: $Id: check_aop_data_object.m,v 1.2 2010/09/23 18:17:54 ingo Exp $
8 %
9
10 function atest = check_aop_data_object(fcn, in1, in2, out)
11 d1 = in1.data;
12 d2 = in2.data;
13
14 if any(strcmpi(func2str(fcn), {'or', 'and', 'xor'}))
15 atest = isa(out.data, 'cdata');
16 else
17 if isa(d1, 'data2D') && isa(d2, 'data2D')
18 if numel(d1.y) > 1
19 dout = d1;
20 elseif numel(d2.y) > 1
21 dout = d2;
22 else
23 dout = d1;
24 end
25 elseif isa(d1, 'data2D') && isa(d2, 'cdata')
26 dout = d1;
27 elseif isa(d1, 'cdata') && isa(d2, 'data2D')
28 dout = d2;
29 else
30 dout = d1;
31 end
32 atest = isa(out.data, class(dout));
33 end
34 end