%
% 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

