diff testing/utp_1.1/utps/ao/utp_ao_convert.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/utps/ao/utp_ao_convert.m	Tue Dec 06 18:42:11 2011 +0100
@@ -0,0 +1,845 @@
+% UTP_AO_CONVERT a set of UTPs for the ao/convert method
+%
+% M Hewitson 06-08-08
+%
+% $Id: utp_ao_convert.m,v 1.10 2011/08/22 04:52:37 hewitson Exp $
+%
+
+% <MethodDescription>
+%
+% The convert method of the ao class perform various conversions on the AO.
+%
+% </MethodDescription>
+
+function results = utp_ao_convert(varargin)
+
+  % Check the inputs
+  if nargin == 0
+
+    % Some keywords
+    class   = 'ao';
+    mthd    = 'convert';
+
+    results = [];
+    disp('******************************************************');
+    disp(['****  Running UTPs for ' class '/' mthd]);
+    disp('******************************************************');
+
+    plts = plist('tsfcn', 'randn(size(t))', 'nsecs', 10, 'fs', 1.12);
+    plfs = plist('f', '1:30', 'fsfcn', 'randn(size(f))');
+    plxy = plist('x', '1:30', 'xyfcn', 'randn(size(x))');
+    at1 = ao(plts);
+    at2 = ao(plfs);
+    at3 = ao(plxy);
+    at4 = ao([1 -3+5i +5 3-1i .5 -7]);
+    atvec = [at1, at2, at3, at4];
+    atmat = [at1, at2, at3; at4, at3, at2];
+
+    % Exception list for the UTPs:
+    [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples();
+
+    % Run the tests
+    results = [results utp_01];    % getInfo call
+    results = [results utp_02];    % Vector input
+    results = [results utp_03];    % Matrix input
+    results = [results utp_04];    % List input
+    results = [results utp_05];    % Test with mixed input
+    results = [results utp_06];    % Test history is working
+    results = [results utp_07];    % Test the modify call works
+    results = [results utp_08];    % Test with additional plist with the key 'axis'
+    results = [results utp_09];    % Test input data shape == output data shape
+    results = [results utp_10];    % Test output of the data
+
+    results = [results utp_11(mthd, [at1 at1], ple1)];    % Test plotinfo doesn't disappear
+    
+    disp('Done.');
+    disp('******************************************************');
+
+  elseif nargin == 1 % Check for UTP functions
+    if strcmp(varargin{1}, 'isutp')
+      results = 1;
+    else
+      results = 0;
+    end
+  else
+    error('### Incorrect inputs')
+  end
+
+  %% UTP_01
+
+  % <TestDescription>
+  %
+  % Tests that the getInfo call works for this method.
+  %
+  % </TestDescription>
+  function result = utp_01
+
+
+    % <SyntaxDescription>
+    %
+    % Test that the getInfo call works for no sets, all sets, and each set
+    % individually.
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      % Call for no sets
+      io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']);
+      % Call for all sets
+      io(2) = eval([class '.getInfo(''' mthd ''')']);
+      % Call for each set
+      for kk=1:numel(io(2).sets)
+        io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']);
+      end
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Check that getInfo call returned an minfo object in all cases.
+    % 2) Check that all plists have the correct parameters.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    if stest
+      % <AlgoCode>
+      % check we have minfo objects
+      if isa(io, 'minfo')
+        % SET 'None'
+        if ~isempty(io(1).sets), atest = false; end
+        if ~isempty(io(1).plists), atest = false; end
+        % Check all Sets
+        if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end
+        if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end
+        % SET 'Default'
+        % Check key
+        if ~io(3).plists.isparam('action'), atest = false; end
+        % Check default value
+        if ~isEmptyChar(io(3).plists.find('action')), atest = false; end
+        % Check options
+        if ~isequal(io(3).plists.getOptionsForParam('action'), {'', 's to Hz', 'Hz to s', 'to cdata', 'to tsdata', 'to fsdata', 'to xydata'}), atest = false; end
+      end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_01
+
+  %% UTP_02
+
+  % <TestDescription>
+  %
+  % Tests that the convert method works with a vector of AOs as input.
+  %
+  % </TestDescription>
+  function result = utp_02
+
+    % <SyntaxDescription>
+    %
+    % Test that the convert method works for a vector of AOs as input.
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      aa = atvec.setYunits('Hz^2 Hz^-1/2 mm mHz');
+      out1 = convert(aa, 'Hz to s');
+      aa = atvec.setYunits('kV s^2 mm s^-1/2 ms');
+      out2 = convert(aa, 's to Hz');
+      out3 = convert(atvec, 'to cdata');
+      out4 = convert(atvec, 'to tsdata');
+      out5 = convert(atvec, 'to fsdata');
+      out6 = convert(atvec, 'to xydata');
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Check that the number of elements in 'out' is the same as in 'atvec'
+    % 2) Check that each output AO contains the correct data.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    TOL   = 1e-15;
+    if stest
+      % <AlgoCode>
+      % Check we have the correct number of outputs
+      if ~isequal(size(out1), size(atvec)), atest = false; end
+      if ~isequal(size(out2), size(atvec)), atest = false; end
+      if ~isequal(size(out3), size(atvec)), atest = false; end
+      if ~isequal(size(out4), size(atvec)), atest = false; end
+      if ~isequal(size(out5), size(atvec)), atest = false; end
+      if ~isequal(size(out6), size(atvec)), atest = false; end
+      % Check that 'out1' have the correct y units.
+      u_ref = unit('s^-2 s^1/2 mm ks^-1');
+      for kk=1:numel(out1)
+        if ~eq(out1(kk).yunits, u_ref), atest = false; end
+      end
+      % Check that 'out2' have the correct y units.
+      u_ref = unit('kV Hz^-2 mm Hz^1/2 kHz^-1');
+      for kk=1:numel(out2)
+        if ~eq(out2(kk).yunits, u_ref), atest = false; end
+      end
+      % Check that 'out3' have the correct data (cdata)
+      for kk=1:numel(out3)
+        if ~isa(out3(kk).data, 'cdata'), atest = false; end
+        if ~isequal(out3(kk).y, atvec(kk).y), atest = false; end
+      end
+      % Check that 'out4' have the correct data (tsdata)
+      for kk=1:numel(out4)
+        if ~isa(out4(kk).data, 'tsdata'), atest = false; end
+        if ~isa(atvec(kk).data, 'cdata')
+          if ~all(abs(out4(kk).x-atvec(kk).x) < TOL), atest = false; end
+        end
+        if ~isequal(out4(kk).y, atvec(kk).y), atest = false; end
+      end
+      % Check that 'out5' have the correct data (fsdata)
+      for kk=1:numel(out5)
+        if ~isa(out5(kk).data, 'fsdata'), atest = false; end
+        if ~isa(atvec(kk).data, 'cdata')
+          if ~isequal(out5(kk).x , atvec(kk).x), atest = false; end
+        end
+        if ~isequal(out5(kk).y, atvec(kk).y), atest = false; end
+      end
+      % Check that 'out6' have the correct data (xydata)
+      for kk=1:numel(out6)
+        if ~isa(out6(kk).data, 'xydata'), atest = false; end
+        if ~isa(atvec(kk).data, 'cdata')
+          if ~isequal(out6(kk).x , atvec(kk).x), atest = false; end
+        end
+        if ~isequal(out6(kk).y, atvec(kk).y), atest = false; end
+      end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_02
+
+  %% UTP_03
+
+  % <TestDescription>
+  %
+  % Tests that the convert method works with a matrix of AOs as input.
+  %
+  % </TestDescription>
+  function result = utp_03
+
+    % <SyntaxDescription>
+    %
+    % Test that the convert method works for a matrix of AOs as input.
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      aa = atmat.setYunits('Hz^2 Hz^-1/2 mm mHz');
+      out1 = convert(aa, 'Hz to s');
+      aa = atmat.setYunits('kV s^2 mm s^-1/2 ms');
+      out2 = convert(aa, 's to Hz');
+      out3 = convert(atmat, 'to cdata');
+      out4 = convert(atmat, 'to tsdata');
+      out5 = convert(atmat, 'to fsdata');
+      out6 = convert(atmat, 'to xydata');
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Check that the number of elements in 'out' is the same as in 'atmat'
+    % 2) Check that each output AO contains the correct data.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    TOL   = 1e-15;
+    if stest
+      % <AlgoCode>
+      % Check we have the correct number of outputs
+      if ~isequal(size(out1), size(atmat)), atest = false; end
+      if ~isequal(size(out2), size(atmat)), atest = false; end
+      if ~isequal(size(out3), size(atmat)), atest = false; end
+      if ~isequal(size(out4), size(atmat)), atest = false; end
+      if ~isequal(size(out5), size(atmat)), atest = false; end
+      if ~isequal(size(out6), size(atmat)), atest = false; end
+      % Check that 'out1' have the correct y units.
+      u_ref = unit('s^-2 s^1/2 mm ks^-1');
+      for kk=1:numel(out1)
+        if ~eq(out1(kk).yunits, u_ref), atest = false; end
+      end
+      % Check that 'out2' have the correct y units.
+      u_ref = unit('kV Hz^-2 mm Hz^1/2 kHz^-1');
+      for kk=1:numel(out2)
+        if ~eq(out2(kk).yunits, u_ref), atest = false; end
+      end
+      % Check that 'out3' have the correct data (cdata)
+      for kk=1:numel(out3)
+        if ~isa(out3(kk).data, 'cdata'), atest = flase; end
+        if ~isequal(out3(kk).y, atmat(kk).y), atest = false; end
+      end
+      % Check that 'out4' have the correct data (tsdata)
+      for kk=1:numel(out4)
+        if ~isa(out4(kk).data, 'tsdata'), atest = flase; end
+        if ~isa(atmat(kk).data, 'cdata')
+          if ~all(abs(out4(kk).x - atmat(kk).x) < TOL), atest = false; end
+        end
+        if ~isequal(out4(kk).y, atmat(kk).y), atest = false; end
+      end
+      % Check that 'out5' have the correct data (fsdata)
+      for kk=1:numel(out5)
+        if ~isa(out5(kk).data, 'fsdata'), atest = flase; end
+        if ~isa(atmat(kk).data, 'cdata')
+          if ~isequal(out5(kk).x , atmat(kk).x), atest = false; end
+        end
+        if ~isequal(out5(kk).y, atmat(kk).y), atest = false; end
+      end
+      % Check that 'out6' have the correct data (xydata)
+      for kk=1:numel(out6)
+        if ~isa(out6(kk).data, 'xydata'), atest = flase; end
+        if ~isa(atmat(kk).data, 'cdata')
+          if ~isequal(out6(kk).x , atmat(kk).x), atest = false; end
+        end
+        if ~isequal(out6(kk).y, atmat(kk).y), atest = false; end
+      end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_03
+
+  %% UTP_04
+
+  % <TestDescription>
+  %
+  % Tests that the convert method works with a list of AOs as input.
+  %
+  % </TestDescription>
+  function result = utp_04
+
+    % <SyntaxDescription>
+    %
+    % Tests that the convert method works with a list of AOs as input.
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      a1 = at1.setYunits('Hz^2 Hz^-1/2 mm mHz');
+      a2 = at2.setYunits('Hz^2 Hz^-1/2 mm mHz');
+      a3 = at3.setYunits('Hz^2 Hz^-1/2 mm mHz');
+      out1 = convert(a1, a2, a3, 'Hz to s');
+      a1 = at1.setYunits('kV s^2 mm s^-1/2 ms');
+      a2 = at2.setYunits('kV s^2 mm s^-1/2 ms');
+      a3 = at3.setYunits('kV s^2 mm s^-1/2 ms');
+      out2 = convert(a1, a2, a3, 's to Hz');
+      out3 = convert(at1, at2, at3, 'to cdata');
+      out4 = convert(at1, at2, at3, 'to tsdata');
+      out5 = convert(at1, at2, at3, 'to fsdata');
+      out6 = convert(at1, at2, at3, 'to xydata');
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Check that the number of elements in 'out' is the same as in 'atmat'
+    % 2) Check that each output AO contains the correct data.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    aoin  = [at1, at2, at3];
+    TOL   = 1e-15;
+    if stest
+      % <AlgoCode>
+      % Check we have the correct number of outputs
+      if ~isequal(size(out1), size(aoin)), atest = false; end
+      if ~isequal(size(out2), size(aoin)), atest = false; end
+      if ~isequal(size(out3), size(aoin)), atest = false; end
+      if ~isequal(size(out4), size(aoin)), atest = false; end
+      if ~isequal(size(out5), size(aoin)), atest = false; end
+      if ~isequal(size(out6), size(aoin)), atest = false; end
+      % Check that 'out1' have the correct y units.
+      u_ref = unit('s^-2 s^1/2 mm ks^-1');
+      for kk=1:numel(out1)
+        if ~eq(out1(kk).yunits, u_ref), atest = false; end
+      end
+      % Check that 'out2' have the correct y units.
+      u_ref = unit('kV Hz^-2 mm Hz^1/2 kHz^-1');
+      for kk=1:numel(out2)
+        if ~eq(out2(kk).yunits, u_ref), atest = false; end
+      end
+      % Check that 'out3' have the correct data (cdata)
+      for kk=1:numel(out3)
+        if ~isa(out3(kk).data, 'cdata'), atest = flase; end
+        if ~isequal(out3(kk).y, aoin(kk).y), atest = false; end
+      end
+      % Check that 'out4' have the correct data (tsdata)
+      for kk=1:numel(out4)
+        if ~isa(out4(kk).data, 'tsdata'), atest = flase; end
+        if ~isa(aoin(kk).data, 'cdata')
+          if ~all(abs(out4(kk).x - aoin(kk).x) < TOL), atest = false; end
+        end
+        if ~isequal(out4(kk).y, aoin(kk).y), atest = false; end
+      end
+      % Check that 'out5' have the correct data (fsdata)
+      for kk=1:numel(out5)
+        if ~isa(out5(kk).data, 'fsdata'), atest = flase; end
+        if ~isa(aoin(kk).data, 'cdata')
+          if ~isequal(out5(kk).x , aoin(kk).x), atest = false; end
+        end
+        if ~isequal(out5(kk).y, aoin(kk).y), atest = false; end
+      end
+      % Check that 'out6' have the correct data (xydata)
+      for kk=1:numel(out6)
+        if ~isa(out6(kk).data, 'xydata'), atest = flase; end
+        if ~isa(aoin(kk).data, 'cdata')
+          if ~isequal(out6(kk).x , aoin(kk).x), atest = false; end
+        end
+        if ~isequal(out6(kk).y, aoin(kk).y), atest = false; end
+      end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_04
+
+  %% UTP_05
+
+  % <TestDescription>
+  %
+  % Tests that the convert method works with a mix of different shaped AOs
+  % as input.
+  %
+  % </TestDescription>
+  function result = utp_05
+
+    % <SyntaxDescription>
+    %
+    % Tests that the convert method works with a mix of different shaped AOs as
+    % input.
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      a1 = at1.setYunits('Hz^2 Hz^-1/2 mm mHz');
+      a2 = at2.setYunits('Hz^2 Hz^-1/2 mm mHz');
+      a3 = at3.setYunits('Hz^2 Hz^-1/2 mm mHz');
+      aa = atmat.setYunits('Hz^2 Hz^-1/2 mm mHz');
+      out1 = convert(a1, a2, aa, a3, 'Hz to s');
+      a1 = at1.setYunits('kV s^2 mm s^-1/2 ms');
+      a2 = at2.setYunits('kV s^2 mm s^-1/2 ms');
+      a3 = at3.setYunits('kV s^2 mm s^-1/2 ms');
+      aa = atmat.setYunits('kV s^2 mm s^-1/2 ms');
+      out2 = convert(a1, a2, aa, a3, 's to Hz');
+      out3 = convert(at1, at2, atmat, at3, 'to cdata');
+      out4 = convert(at1, at2, atmat, at3, 'to tsdata');
+      out5 = convert(at1, at2, atmat, at3, 'to fsdata');
+      out6 = convert(at1, at2, atmat, at3, 'to xydata');
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Check that the number of elements in 'out' is the same as in 'atmat'
+    % 2) Check that each output AO contains the correct data.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    aoin  = [at1, at2, reshape(atmat, 1, []), at3];
+    TOL   = 1e-15;
+    if stest
+      % <AlgoCode>
+      % Check we have the correct number of outputs
+      if ~isequal(size(out1), size(aoin)), atest = false; end
+      if ~isequal(size(out2), size(aoin)), atest = false; end
+      if ~isequal(size(out3), size(aoin)), atest = false; end
+      if ~isequal(size(out4), size(aoin)), atest = false; end
+      if ~isequal(size(out5), size(aoin)), atest = false; end
+      if ~isequal(size(out6), size(aoin)), atest = false; end
+      % Check that 'out1' have the correct y units.
+      u_ref = unit('s^-2 s^1/2 mm ks^-1');
+      for kk=1:numel(out1)
+        if ~eq(out1(kk).yunits, u_ref), atest = false; end
+      end
+      % Check that 'out2' have the correct y units.
+      u_ref = unit('kV Hz^-2 mm Hz^1/2 kHz^-1');
+      for kk=1:numel(out2)
+        if ~eq(out2(kk).yunits, u_ref), atest = false; end
+      end
+      % Check that 'out3' have the correct data (cdata)
+      for kk=1:numel(out3)
+        if ~isa(out3(kk).data, 'cdata'), atest = flase; end
+        if ~isequal(out3(kk).y, aoin(kk).y), atest = false; end
+      end
+      % Check that 'out4' have the correct data (tsdata)
+      for kk=1:numel(out4)
+        if ~isa(out4(kk).data, 'tsdata'), atest = flase; end
+        if ~isa(aoin(kk).data, 'cdata')
+          if ~all(abs(out4(kk).x - aoin(kk).x) < TOL), atest = false; end
+        end
+        if ~isequal(out4(kk).y, aoin(kk).y), atest = false; end
+      end
+      % Check that 'out5' have the correct data (fsdata)
+      for kk=1:numel(out5)
+        if ~isa(out5(kk).data, 'fsdata'), atest = flase; end
+        if ~isa(aoin(kk).data, 'cdata')
+          if ~isequal(out5(kk).x , aoin(kk).x), atest = false; end
+        end
+        if ~isequal(out5(kk).y, aoin(kk).y), atest = false; end
+      end
+      % Check that 'out6' have the correct data (xydata)
+      for kk=1:numel(out6)
+        if ~isa(out6(kk).data, 'xydata'), atest = flase; end
+        if ~isa(aoin(kk).data, 'cdata')
+          if ~isequal(out6(kk).x , aoin(kk).x), atest = false; end
+        end
+        if ~isequal(out6(kk).y, aoin(kk).y), atest = false; end
+      end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_05
+
+  %% UTP_06
+
+  % <TestDescription>
+  %
+  % Tests that the convert method properly applies history.
+  %
+  % </TestDescription>
+  function result = utp_06
+
+    % <SyntaxDescription>
+    %
+    % Test that the result of applying the convert method can be processed back.
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      out = convert(at1, 'to fsdata');
+      mout = rebuild(out);
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Check that the last entry in the history of 'out' corresponds to
+    %    'convert'.
+    % 2) Check that the re-built object is the same object as the input.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    if stest
+      % <AlgoCode>
+      % Check the last step in the history of 'out'
+      if ~strcmp(out.hist.methodInfo.mname, 'convert'), atest = false; end
+      % The rebuilt object must be the same as 'out'
+      if ~eq(mout, out, ple2), atest = false; end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_06
+
+  %% UTP_07
+
+  % <TestDescription>
+  %
+  % Tests that the convert method can modify the input AO.
+  %
+  % </TestDescription>
+  function result = utp_07
+
+    % <SyntaxDescription>
+    %
+    % Test that the convert method can modify the input AO by calling with no
+    % output and that the method doesn't change the input of the function
+    % notation (with a equal sign).
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      % copy at1 to work with
+      amodi = ao(at1);
+      aeq   = ao(at1);
+      out = aeq.convert('to xydata');
+      amodi.convert('to xydata');
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Check that 'out' and 'aeq' are now different.
+    % 2) Check that 'aeq' is not changed
+    % 3) Check that the modified input is the convert value of the copy
+    % 4) Check that out and amodi are the same
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    if stest
+      % <AlgoCode>
+      % Check that 'out' and 'aeq' are now different.
+      if eq(out, aeq, ple2), atest = false; end
+      % Check that 'aeq' is not changed
+      if ~eq(aeq, ao(at1), ple1), atest = false; end
+      % Check that the modified input is the converted object of the copy
+      if ~isa(amodi.data, 'xydata'), atest = false; end
+      % Check that out and amodi are the same
+      if ~eq(out, amodi, ple2), atest = false; end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_07
+
+  %% UTP_08
+
+  % <TestDescription>
+  %
+  % Control the method with a plist.
+  %
+  % </TestDescription>
+  function result = utp_08
+
+    % <SyntaxDescription>
+    %
+    % Test that the convert method can modify the input object depending
+    % to the plist.
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      pl1 = plist('action', 'Hz to s');
+      pl2 = plist('action', 's to Hz');
+      pl3 = plist('action', 'to tsdata');
+      pl4 = plist('action', 'to fsdata');
+      pl5 = plist('action', 'to cdata');
+      pl6 = plist('action', 'to xydata');
+      aa = ao(at1);
+      aa.setYunits('Hz');
+      out1 = convert(aa, pl1);
+      aa = ao(at1);
+      aa.setYunits('s');
+      out2 = convert(aa, pl2);
+      out3 = convert(at1, pl3);
+      out4 = convert(at1, pl4);
+      out5 = convert(at1, pl5);
+      out6 = convert(at1, pl6);
+      mout1 = rebuild(out1);
+      mout2 = rebuild(out2);
+      mout3 = rebuild(out3);
+      mout4 = rebuild(out4);
+      mout5 = rebuild(out5);
+      mout6 = rebuild(out6);
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Check that the convert method aplpiesthe different actions
+    % 4) Check that the rebuilt objects are the same as 'out[1..6]'.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    if stest
+      % <AlgoCode>
+      % Check each output
+      if ~eq(out1.yunits, unit('s^-1')),  atest = false; end
+      if ~eq(out2.yunits, unit('Hz^-1')), atest = false; end
+      if ~isa(out3.data, 'tsdata'), atest = false; end
+      if ~isequal(out3.y, at1.y), atest = false; end
+      if ~isa(out4.data, 'fsdata'), atest = false; end
+      if ~isequal(out4.y, at1.y), atest = false; end
+      if ~isa(out5.data, 'cdata'), atest = false; end
+      if ~isequal(out5.y, at1.y), atest = false; end
+      if ~isa(out6.data, 'xydata'), atest = false; end
+      if ~isequal(out6.y, at1.y), atest = false; end
+      % Run 'test[1..3].m' and check the result
+      if ~eq(mout1, out1, ple2), atest = false; end
+      if ~eq(mout2, out2, ple2), atest = false; end
+      if ~eq(mout3, out3, ple2), atest = false; end
+      if ~eq(mout4, out4, ple2), atest = false; end
+      if ~eq(mout5, out5, ple2), atest = false; end
+      if ~eq(mout6, out6, ple2), atest = false; end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_08
+
+  %% UTP_09
+
+  % <TestDescription>
+  %
+  % Test the shape of the output.
+  %
+  % </TestDescription>
+  function result = utp_09
+
+    % <SyntaxDescription>
+    %
+    % Test that the convert method keeps the data shape of the input object. The
+    % input AO must be an AO with row data and an AO with column data.
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      aocol = ao(at1);
+      aorow = at1.';
+      out1 = convert(aocol, 'to fsdata');
+      out2 = convert(aorow, 'to fsdata');
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Check that the shape of the data doesn't change.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    if stest
+      % <AlgoCode>
+      % Check the shape of the output data
+      if size(out1.data.y,2) ~= 1, atest = false; end
+      if size(out2.data.y,1) ~= 1, atest = false; end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_09
+
+  %% UTP_10
+
+  % <TestDescription>
+  %
+  % Check that the convert method pass back the output objects to a list of
+  % output variables or to a single variable.
+  %
+  % </TestDescription>
+  function result = utp_10
+
+    % <SyntaxDescription>
+    %
+    % Call the method with a list of output variables and with a single output
+    % variable. Additionaly check that the rebuild method works on the output.
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      [o1, o2] = convert(at1, at2, 'to cdata');
+      o3  = convert(at1, at2, 'to cdata');
+      mout1 = rebuild(o1);
+      mout2 = rebuild(o2);
+      mout3 = rebuild(o3);
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Check that the output contains the right number of objects
+    % 2) Check that the 'rebuild' method produces the same object as 'out'.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    if stest
+      % <AlgoCode>
+      % Check the number of outputs
+      if numel(o1) ~=1, atest = false; end
+      if numel(o2) ~=1, atest = false; end
+      if numel(o3) ~=2, atest = false; end
+      % Check the rebuilding of the object
+      if ~eq(o1, mout1, ple2), atest = false; end
+      if ~eq(o2, mout2, ple2), atest = false; end
+      if ~eq(o3, mout3, ple2), atest = false; end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_10
+
+end