view testing/utp_1.1/utp_test_files/loadAllFiles.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 source


clc;

matfiles = utils.prog.filescan('.', '.mat');
xmlfiles = utils.prog.filescan('.', '.xml');

currentVer = '';
currentCl  = '';

for j=1:numel(matfiles)
  fn = matfiles{j};
  [path, name, ext, ver] = fileparts(fn);
  [cl, rest] = strtok(name, '_');
  [v, rest] = strtok(rest, '_');
  if ~strcmp(v, currentVer) || ~strcmp(cl, currentCl)
    currentCl  = cl;
    currentVer = v;
    fprintf('%%%% Loading MAT files of class: %s and version: %s\n', cl, currentVer);
  end
  try
    warning('off', 'MATLAB:unknownElementsNowStruc');
    obj = feval(cl, fn);
    warning('on', 'MATLAB:unknownElementsNowStruc');
  catch err
    fprintf(2, '----- Loading %s failed. ', fn);
    fprintf(2, '%s\n', err.message);
  end
end

currentVer = '';
currentCl  = '';

for j=1:numel(xmlfiles)
  fn = xmlfiles{j};
  [path, name, ext, ver] = fileparts(fn);
  [cl, rest] = strtok(name, '_');
  [v, rest] = strtok(rest, '_');
  if ~strcmp(v, currentVer) || ~strcmp(cl, currentCl)
    currentCl  = cl;
    currentVer = v;
    fprintf('%%%% Loading XML files of class: %s and version: %s\n', cl, currentVer);
  end
  try
    obj = feval(cl, fn);
  catch err
    fprintf(2, '----- Loading %s failed. ', fn);
    fprintf(2, '%s\n', err.message)
  end
end

disp('%%%% Done.');