Mercurial > hg > ltpda
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/check_aop_data_object.m Tue Dec 06 18:42:11 2011 +0100 @@ -0,0 +1,34 @@ +% +% DESCRIPTION: Generic check for a arithmetic operator unit test which +% checks the datatype for a single inputs. +% +% CALL: atest = check_aop_data_object(fcn, in1, in2, out); +% +% VERSION: $Id: check_aop_data_object.m,v 1.2 2010/09/23 18:17:54 ingo Exp $ +% + +function atest = check_aop_data_object(fcn, in1, in2, out) + d1 = in1.data; + d2 = in2.data; + + if any(strcmpi(func2str(fcn), {'or', 'and', 'xor'})) + atest = isa(out.data, 'cdata'); + else + if isa(d1, 'data2D') && isa(d2, 'data2D') + if numel(d1.y) > 1 + dout = d1; + elseif numel(d2.y) > 1 + dout = d2; + else + dout = d1; + end + elseif isa(d1, 'data2D') && isa(d2, 'cdata') + dout = d1; + elseif isa(d1, 'cdata') && isa(d2, 'data2D') + dout = d2; + else + dout = d1; + end + atest = isa(out.data, class(dout)); + end +end