view testing/utp_1.1/generic_utps/utp_08.m @ 50:7d2e2e065cf1 database-connection-manager

Update unit tests
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:24:37 +0100
parents 409a22968d5e
children
line wrap: on
line source


% <TestDescription>
%
% Test that the <METHOD> method uses the plist to get the axis.
%
% </TestDescription>
function result = utp_08(method, obj1, ple1)
  
  % <SyntaxDescription>
  %
  % Test that the <METHOD> method uses the plist to get the axis.
  %
  % </SyntaxDescription>
  
  try
    % <SyntaxCode>
    plx  = plist('axis', 'X');
    ply  = plist('axis', 'Y');
    plxy = plist('axis', 'XY');
    out1 = feval(method, obj1, plx);
    out2 = feval(method, obj1, ply);
    out3 = feval(method, obj1, plxy);
    mout1 = rebuild(out1);
    mout2 = rebuild(out2);
    mout3 = rebuild(out3);
    % </SyntaxCode>
    stest = true;
  catch err
    disp(err.message)
    stest = false;
  end
  
  % <AlgoDescription>
  %
  % 1) Check that the <METHOD> method applies to the x-axis
  % 2) Check that the <METHOD> method applies to the y-axis
  % 3) Check that the <METHOD> method applies to both axes
  % 4) Check that the re-built object is the same as in 'out[1..3]'.
  %
  % </AlgoDescription>
  
  atest = true;
  if stest
    % <AlgoCode>
    % Check each output against the correct values
    if ~isequal(feval(method, obj1.data.getX), out1.data.getX), atest = false; end
    if ~isequal(obj1.data.getY, out1.data.getY), atest = false; end
    if ~isequal(obj1.data.getX, out2.data.getX), atest = false; end
    if ~isequal(feval(method,obj1.data.getY), out2.data.getY), atest = false; end
    if ~isequal(feval(method,obj1.data.getX), out3.data.getX), atest = false; end
    if ~isequal(feval(method,obj1.data.getY), out3.data.getY), atest = false; end
    % Check the re-built objects
    if ~eq(mout1, out1, ple1), atest = false; end
    if ~eq(mout2, out2, ple1), atest = false; end
    if ~eq(mout3, out3, ple1), atest = false; end
    % </AlgoCode>
  else
    atest = false;
  end
  
  % Return a result structure
  dd = dbstack;
  mfilename = dd(2).file(1:end-2);  
  result = utp_prepare_result(atest, stest, dbstack, mfilename);
end % END UTP_08