view testing/utp_1.1/generic_utps/check_aop_units.m @ 52:daf4eab1a51e database-connection-manager tip

Fix. Default password should be [] not an empty string
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:29:47 +0100
parents 409a22968d5e
children
line wrap: on
line source

%
% DESCRIPTION: Generic check for a arithmetic operator unit test which
%              checks the y-units for a single inputs.
%
% CALL:        atest = check_aop_units(fcn, in1, in2, out);
%
% VERSION:     $Id: check_aop_units.m,v 1.3 2010/09/23 18:19:21 ingo Exp $
%

function atest = check_aop_units(fcn, in1, in2, out)
  if utils.helper.ismember(func2str(fcn), {'plus', 'minus'})
    % return the first non-empty
    if ~isempty(in1.data.yunits.strs)
      uo = in1.data.yunits;
    else
      uo = in2.data.yunits;
    end
  elseif utils.helper.ismember(func2str(fcn), {'or', 'and', 'xor'})
    uo = unit();
  else
    % For other operators we need to apply the operator
    uo = fcn(in1.data.yunits, in2.data.yunits);
  end
  
  atest = eq(uo, out.yunits);
  
end