Skip to content

Commit

Permalink
issue #31: fixed errors, directed output of eval-function calls to lo…
Browse files Browse the repository at this point in the history
…gger.info
  • Loading branch information
dimamih authored and irublev committed Feb 23, 2018
1 parent 4274f32 commit c0fbb47
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 34 deletions.
10 changes: 4 additions & 6 deletions products/+elltool/+core/+test/+mlunit/EllipsoidBasicSecondTC.m
Original file line number Diff line number Diff line change
Expand Up @@ -535,21 +535,19 @@ function checkScalGRBBF()
'wrongInput:wrongSizes');
end
function self = testDisplay(self)
import elltool.logging.Log4jConfigurator;
logger=Log4jConfigurator.getLogger();
ellEmptArr = self.ellipsoid.empty([0,0,2,0]); %#ok<NASGU>
logger.info(evalc('display(ellEmptArr)'));
evalc('display(ellEmptArr)');
%
centVec = [1;1];
shapeMat = eye(2);
ellObj = self.ellipsoid(centVec,shapeMat);
logger.info(evalc('display(ellObj)'));
evalc('display(ellObj)');
%
ellMat = ellObj.repMat([2,2]); %#ok<NASGU>
logger.info(evalc('display(ellMat)'));
evalc('display(ellMat)');
%
ellArr = ellObj.repMat([2,2,3,4,5]); %#ok<NASGU>
logger.info(evalc('display(ellArr)'));
evalc('display(ellArr)');
end
function self = testProjection(self)
projMat = [1 0 0;0 1 0]';
Expand Down
4 changes: 1 addition & 3 deletions products/+elltool/+core/+test/+mlunit/GenEllipsoidTestCase.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ function set_up_param(self)
end
%
function testDisplaySimple(~)
import elltool.logging.Log4jConfigurator;
logger=Log4jConfigurator.getLogger();
ell1=elltool.core.GenEllipsoid([1;1],eye(2));
ell2=elltool.core.GenEllipsoid([1;0],eye(2));
ell3=elltool.core.GenEllipsoid([0;1],eye(2));
ellMat=[ell1,ell2,ell3;ell1,ell2,ell3]; %#ok<NASGU>
logger.info(evalc('display(ellMat)'));
evalc('display(ellMat)');
end
%
function self = testConstructor(self)
Expand Down
6 changes: 2 additions & 4 deletions products/+elltool/+core/+test/+mlunit/HyperplaneTestCase.m
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,11 @@ function tear_down(~)
end
%
function self = testDisplay(self)
import elltool.logging.Log4jConfigurator;
logger=Log4jConfigurator.getLogger();
SInpData = self.auxReadFile(self);
testHyperplane = SInpData.testHyperplane; %#ok<NASGU>
logger.info(evalc('display(testHyperplane);'));
evalc('display(testHyperplane);');
testHyperplaneVec = SInpData.testHyperplaneVec; %#ok<NASGU>
logger.info(evalc('display(testHyperplaneVec);'));
evalc('display(testHyperplaneVec);');
end
%
% function self = testPlot(self)
Expand Down
4 changes: 2 additions & 2 deletions products/+elltool/+demo/+test/+mlunit/ETManualTC.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ function tear_down(self)
end
%
function self = testBasic(self)
import elltool.logging.Log4jConfigurator;
logger=Log4jConfigurator.getLogger();
currentDir = fileparts(which(mfilename('class')));
rootDir = modgen.path.rmlastnpathparts(currentDir, 5);
snippetsDir = [rootDir, filesep, 'products', filesep,...
Expand All @@ -42,8 +44,6 @@ function tear_down(self)
end
end
if ~isBad
import elltool.logging.Log4jConfigurator;
logger=Log4jConfigurator.getLogger();
[~, fileName] = fileparts(nameStr);
logger.info(evalc(['elltool.doc.snip.' fileName]));
end
Expand Down
1 change: 0 additions & 1 deletion products/+elltool/+linsys/+test/+mlunit/LinSysTestCase.m
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ function set_up_param(self)
{'t', '1', 'cos(t)'; '1' '0' 't'; 'sin(t)', 't', '2'}, ...
{'t', 'cos(t)'; 'sin(t)', 't'; 'cos(t)', 'sin(t)'}, ...
UEll, eye(3,5),ell_unitball(5),eye(2,3),ell_unitball(2));
%evalc('system.display();');
resStr = evalc('display(system)');
isOk = ~isempty(strfind(resStr,'A'));
isOk = ~isempty(strfind(resStr,'B')) && isOk;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,7 @@ function check(isRegEnabled,isJustCheck,regTol,expErrTag,isNeg)
if isNeg
self.runAndCheckError(evalStr,expErrTag);
else
import elltool.logging.Log4jConfigurator;
logger=Log4jConfigurator.getLogger();
logger.info(evalc(evalStr));
evalc(evalStr);
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ function set_up_param(self, varargin)
end
%
function self = testFirstBasicTest(self)
import elltool.logging.Log4jConfigurator;
logger=Log4jConfigurator.getLogger();
loadFileStr = strcat(self.testDataRootDir,...
'/demo3DiscreteTest.mat');
load(loadFileStr, 'aMat', 'bMat', 'ControlBounds',...
Expand All @@ -40,7 +38,7 @@ function set_up_param(self, varargin)
%timeVec = [0, 3];
reachSetObj = self.reachDiscrete(linSysObj,...
x0Ell, l0Mat, timeVec);
logger.info(evalc('reachSetObj.display();'));
evalc('reachSetObj.display();');
firstCutReachObj =...
reachSetObj.cut([timeVec(1)+1 timeVec(end)-1]);
[~] = reachSetObj.cut(timeVec(1)+2);
Expand All @@ -66,8 +64,6 @@ function set_up_param(self, varargin)
end
%
function self = testSecondBasicTest(self)
import elltool.logging.Log4jConfigurator;
logger=Log4jConfigurator.getLogger();
loadFileStr = strcat(self.testDataRootDir,...
'/distorbDiscreteTest.mat');
load(loadFileStr, 'aMat', 'bMat', 'ControlBounds',...
Expand All @@ -76,7 +72,7 @@ function set_up_param(self, varargin)
ControlBounds, gMat, DistorbBounds,'d');
reachSetObj = self.reachDiscrete(linSysObj,...
x0Ell, l0Mat, timeVec);
logger.info(evalc('reachSetObj.display();'));
evalc('reachSetObj.display();');
firstCutReachObj =...
reachSetObj.cut([timeVec(1)+1 timeVec(end)-1]);
[~] = reachSetObj.cut(timeVec(1)+2);
Expand Down
6 changes: 2 additions & 4 deletions products/+gras/+ellapx/+smartdb/+test/+mlunit/ExamplesTC.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ function test_examples(~)
nExamples=numel(exampleNameList);
for iExample=1:nExamples
try
import elltool.logging.Log4jConfigurator;
logger=Log4jConfigurator.getLogger();
exampleName=[examplePkgName,'.',...
exampleNameList{iExample}(1:end-2)];
logger.info(evalc(exampleName));
exampleNameList{iExample}(1:end-2)];
evalc(exampleName);
catch meObj
newMeObj=throwerror('testRunProblem','failed to run %s',...
exampleName');
Expand Down
14 changes: 10 additions & 4 deletions products/+gras/+ellapx/+smartdb/+test/+mlunit/SuiteEllTube.m
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,14 @@ function checkMaster(fGetScaleAndReg)
end
%%
function check(errorTag,cmdStr)
import elltool.logging.Log4jConfigurator;
logger=Log4jConfigurator.getLogger();
CMD_STR='rel1.getCopy().unionWith(rel2)';
if nargin<2
cmdStr=CMD_STR;
end
if nargin==0
eval(cmdStr);
if nargin==0
logger.info(evalc(cmdStr));
else
self.runAndCheckError(cmdStr,errorTag);
end
Expand Down Expand Up @@ -483,13 +485,15 @@ function testSimpleNegRegCreate(self)
approxSchemaDescr,ABS_TOL, REL_TOL);
end
function check(errorTag,cmdStr)
import elltool.logging.Log4jConfigurator;
logger=Log4jConfigurator.getLogger();
CMD_STR='rel1.getCopy().unionWith(rel2)';
if nargin<2
cmdStr=CMD_STR;
end
if nargin==0
if ischar(cmdStr)
eval(cmdStr);
logger.info(evalc(cmdStr));
else
feval(cmdStr);
end
Expand Down Expand Up @@ -747,6 +751,8 @@ function badAction()
end
end
function aux_testSimpleCreate(self,isApproxSchemaUniform)
import elltool.logging.Log4jConfigurator;
logger=Log4jConfigurator.getLogger();
nPoints=3;
ABS_TOL = 10^(-3);
REL_TOL = 10^(-3);
Expand Down Expand Up @@ -781,7 +787,7 @@ function aux_testSimpleCreate(self,isApproxSchemaUniform)
function check(errorTag)
CMD_STR='rel1.getCopy().unionWith(rel2)';
if nargin==0
eval(CMD_STR);
logger.info(evalc(CMD_STR));
else
self.runAndCheckError(CMD_STR,...
errorTag);
Expand Down
4 changes: 3 additions & 1 deletion products/+gras/+ellapx/+smartdb/+util/updateondiskrels.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ function updateondiskrels(dirName)
% Faculty of Computational Mathematics and Computer Science,
% System Analysis Department 2015 $
%
import elltool.logging.Log4jConfigurator;
logger=Log4jConfigurator.getLogger();
if ~strcmp(dirName(end),filesep)
dirName=[dirName,filesep];
end
Expand All @@ -27,7 +29,7 @@ function updateondiskrels(dirName)
nVars=numel(varNameList);
for iVar=1:nVars
varName=varNameList{iVar};
eval([varName,'=SRes.',varName,';']);
logger.info(evalc([varName,'=SRes.',varName,';']));
end
save(fullFileName,varNameList{:});
end

0 comments on commit c0fbb47

Please sign in to comment.