ApCoCoA-1:TestMexFiles

From ApCoCoAWiki
Revision as of 15:29, 18 June 2008 by Matthias Machnik (talk | contribs) (Initial set up)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Example calls for mex functions

<matlab> function TestBuildInfoApCoCoALib

 global testOk testFail maxChars
 dispString = 'BuildInfoApCoCoALib';
 try
   disp('----------')
   BuildInfoApCoCoALibToolBox()
   disp('----------')
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK'])
   testOk = testOk + 1;
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars
 

function TestAPVI

 global testOk testFail maxChars
 dispString = 'APVI';
 try
   Points = [1 0 0 ; 0 0 1 ; 0 2 0];
   Eps = 0.001;
   [ResBasis, ResOrderIdeal] = APVI_wrap(Points, Eps);
   r1 = CoCoARing('Typ','Q', 'Noindets', 3 , 'Indets', 'auto' , 'Ordering', 'DegRevLex');
   % Note: Coefficients are adjusted due to rounding issues
   terms = [1.0 1 0 0 ; 0.49999999999999994 0 1 0 ; 1 0 0 1 ; -1.0 0 0 0];
   cp1 = CoCoAPoly('Ring',r1,'Terms',terms);
   terms = [1.0 0 0 2 ; -1 0 0 1];
   cp2 = CoCoAPoly('Ring',r1,'Terms',terms);
   terms = [0.5 0 1 1];
   cp3 = CoCoAPoly('Ring',r1,'Terms',terms);
   terms = [0.25 0 2 0 ; -0.5 0 1 0];
   cp4 = CoCoAPoly('Ring',r1,'Terms',terms);
   terms = [1.0 0 0 0];
   cp5 = CoCoAPoly('Ring',r1,'Terms',terms);
   terms = [1.0 0 0 1];
   cp6 = CoCoAPoly('Ring',r1,'Terms',terms);
   terms = [1 0 1 0];
   cp7 = CoCoAPoly('Ring',r1,'Terms',terms);
   CompareGB = [cp1 cp2 cp3 cp4];
   CompareOI = [cp5 cp6 cp7];
   if (ResBasis == CompareGB) && (ResOrderIdeal == CompareOI) %#ok<BDSCI>
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK'])
     testOk = testOk + 1;
   else
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail: Different result'])
     testFail = testFail + 1;
   end
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars
 

function TestBorderBasisIdeal

 global testOk testFail maxChars
 dispString = 'BorderBasisIdeal';
 try
   Id1 = CoCoAIdeal([CoCoAPoly('0x+0y+x^2') CoCoAPoly('0x+0y+xy+y^2')]);
   Result = BorderBasisIdeal_wrap(Id1);
   Compare = [CoCoAPoly('0x+0y+xy+y^2') CoCoAPoly('0x+0y+x^2') CoCoAPoly('0x+0y+y^3') CoCoAPoly('0x+0y+xy^2')];
 
   if (Result == Compare) %#ok<BDSCI>
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK' ])
     testOk = testOk + 1;
   else
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail: Different result'])
     testFail = testFail + 1;
   end
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars
 

function TestFGLM

 global testOk testFail maxChars
 dispString = 'FGLM';
 try
   GBOld = [CoCoAPoly('0x+0y+0z+z^4 -3z^3 - 4yz + 2z^2 - y + 2z - 2'), CoCoAPoly('0x+0y+0z+yz^2 + 2yz - 2z^2 + 1'), CoCoAPoly('0x+0y+0z+y^2 - 2yz + z^2 - z'), CoCoAPoly('0x+0y+0z+x + y - z')];
   NewTO = eye(3);
   [Result, RingNew] = FGLM_wrap(GBOld, NewTO);
   p1 = CoCoAPoly('Ring',RingNew,'Terms',[1 0 0 6 ; -1 0 0 5 ; -4 0 0 4 ; -2 0 0 3 ; 1 0 0 0]);
   p2 = CoCoAPoly('Ring',RingNew,'Terms',[1 0 1 0 ; -0.5714285714285714 0 0 5 ; 0.7142857142857143 0 0 4 ; 1.8571428571428572 0 0 3 ; 1.4285714285714286 0 0 2 ; -0.8571428571428571 0 0 1; -0.2857142857142857 0 0 0]);
   p3 = CoCoAPoly('Ring',RingNew,'Terms',[1 1 0 0 ; 0.5714285714285714 0 0 5 ; -0.7142857142857143 0 0 4 ; -1.8571428571428572 0 0 3 ; -1.4285714285714286 0 0 2 ; -0.14285714285714285 0 0 1; 0.2857142857142857 0 0 0]);
   Compare = [p1 p2 p3];
 
   if (Result == Compare) %#ok<BDSCI>
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK' ])
     testOk = testOk + 1;
   else
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail: Different result'])
     testFail = testFail + 1;
   end
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars
 

function TestBuildInfoCoCoALib

 global testOk testFail maxChars
 dispString = 'BuildInfoCoCoALib';
 try
   disp('----------')
   BuildInfoCoCoALibToolBox()
   disp('----------')
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK'])
   testOk = testOk + 1;
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars

function TestPolyPower

 global testOk testFail maxChars
 dispString = 'PolyPower';
 try
   Interim = CoCoAPoly('x^2-y+2');
   Result = Interim^2;
   Compare = CoCoAPoly('x^4-2x^2y+4x^2+y^2-4y+4');
   if (Result == Compare)
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK'])
     testOk = testOk + 1;
   else
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail: Different result'])
     testFail = testFail + 1;
   end
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars

function TestPolyRingHom

 global testOk testFail maxChars
 dispString = 'PolyRingHom';
 try
   poly = CoCoAPoly('x+y-z+1');
   imagePolys = [CoCoAPoly('0x+0y+0z+x^2') CoCoAPoly('0x+0y+0z-y') CoCoAPoly('0x+0y+0z+1.5z')];
   Result = PolyRingHom_wrap(poly, imagePolys);
   Compare = CoCoAPoly('x^2-y-1.5z+1');
   if (Result == Compare)
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK'])
     testOk = testOk + 1;
   else
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail: Different result'])
     testFail = testFail + 1;
   end
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars

function TestColonIdeal

 global testOk testFail maxChars
 dispString = 'ColonIdeal';
 try
   id1 = CoCoAIdeal([CoCoAPoly('xy') CoCoAPoly('x^2+0y')]);
   id2 = CoCoAIdeal(CoCoAPoly('x+0y'));
   Result = ColonIdeal_wrap(id1,id2);
   Compare = [CoCoAPoly('0x+y') CoCoAPoly('x+0y')];
   if (Result == Compare)
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK'])
     testOk = testOk + 1;
   else
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail: Different result'])
     testFail = testFail + 1;
   end
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars
 

function TestCColonIdeal

 global testOk testFail maxChars
 dispString = 'CColonIdeal';
 try
   id1 = CoCoAIdeal([CoCoAPoly('xy') CoCoAPoly('x^2+0y')]);
   id2 = CoCoAIdeal(CoCoAPoly('x+0y'));
   Result = CColonIdeal_wrap(id1,id2);
   Compare = [CoCoAPoly('0x+y') CoCoAPoly('x+0y')];
   if (Result == Compare)
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK'])
     testOk = testOk + 1;
   else
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail: Different result'])
     testFail = testFail + 1;
   end
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars

function TestSyzygyPolyList

 global testOk testFail maxChars
 dispString = 'SyzygyPolyList';
 try
   pList = [CoCoAPoly('x^2-y+0z') CoCoAPoly('xy-z') CoCoAPoly('xy+0z')];
   Result = SyzygyPolyList_wrap(pList);
   Compare = [CoCoAPoly('0x+0y+0z+0') CoCoAPoly('xy+0z') CoCoAPoly('-xy+z') ; CoCoAPoly('0x+0y+z') CoCoAPoly('x^2-y+0z') CoCoAPoly('-x^2+y+0z') ; CoCoAPoly('xy+0z') CoCoAPoly('0x+0y+0z+0') CoCoAPoly('-x^2+y+0z') ; CoCoAPoly('0x+yz') CoCoAPoly('0x-y^2+0z') CoCoAPoly('0x+y^2-xz')];
   if (Result == Compare)
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK'])
     testOk = testOk + 1;
   else
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail: Different result'])
     testFail = testFail + 1;
   end
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars

function TestGBasisIdeal

 global testOk testFail maxChars
 dispString = 'GBasisIdeal';
 try
   ideal = CoCoAIdeal([CoCoAPoly('0x+0y+0z+x^3-y+0z') CoCoAPoly('0x+0y+0z+x^4+0y-z')]);
   Result = GBasisIdeal_wrap(ideal);
   Compare = [CoCoAPoly('0x+0y+0z+x^3-y+0z') CoCoAPoly('0x+0y+0z+xy-z') CoCoAPoly('0x+0y+0z+x^2z-y^2') CoCoAPoly('0x+0y+0z+y^3-xz^2')];
   if (Result == Compare)
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK'])
     testOk = testOk + 1;
   else
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail: Different result'])
     testFail = testFail + 1;
   end
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars

function TestSATGBasisIdeal

 global testOk testFail maxChars
 dispString = 'SATGBasisIdeal';
 try
   ideal = CoCoAIdeal([CoCoAPoly('0x+0y+0z+x^3-y') CoCoAPoly('0x+0y+0z+x^4-z')]);
   Result = SATGBasisIdeal_wrap(ideal);
   Compare = [CoCoAPoly('0x+0y+0z+x^3-y') CoCoAPoly('0x+0y+0z+xy-z') CoCoAPoly('0x+0y+0z+x^2z-y^2') CoCoAPoly('0x+0y+0z+y^3-xz^2')];
   if (Result == Compare)
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK'])
     testOk = testOk + 1;
   else
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail: Different result'])
     testFail = testFail + 1;
   end
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars

function TestSATMixGBasisIdeal

 global testOk testFail maxChars
 dispString = 'SATMixGBasisIdeal';
 try
   ideal = CoCoAIdeal([CoCoAPoly('0x+0y+0z+x^3-y+0z') CoCoAPoly('0x+0y+0z+x^4+0y-z')]);
   Result = SATMixGBasisIdeal_wrap(ideal);
   Compare = [CoCoAPoly('0x+0y+0z+x^3-y+0z') CoCoAPoly('0x+0y+0z+xy-z') CoCoAPoly('0x+0y+0z+x^2z-y^2') CoCoAPoly('0x+0y+0z+y^3-xz^2')];
   if (Result == Compare)
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK'])
     testOk = testOk + 1;
   else
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail: Different result'])
     testFail = testFail + 1;
   end
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars

function TestPreProcessGrid

 global testOk testFail maxChars
 dispString = 'Preprocess "Grid"';
 try
   points = [-1 0 ; 0 0 ; 1 0 ; 99 1 ; 99 0 ; 99 -1];
   toler = [3 3];
   Result = Preprocess(toler,points,1);
   Compare = [0 0 ; 99 0];
   if (Result == Compare)
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK'])
     testOk = testOk + 1;
   else
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail: Different result'])
     testFail = testFail + 1;
   end
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars

function TestPreProcessAggr

 global testOk testFail maxChars
 dispString = 'Preprocess "Aggr"';
 try
   points = [-1 0 ; 0 0 ; 1 0 ; 99 1 ; 99 0 ; 99 -1];
   toler = [3 3];
   Result = Preprocess(toler,points,2);
   Compare = [0 0 ; 99 0];
   if (Result == Compare)
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK'])
     testOk = testOk + 1;
   else
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail: Different result'])
     testFail = testFail + 1;
   end
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars

function TestPreProcessSubdiv

 global testOk testFail maxChars
 dispString = 'Preprocess "Subdiv"';
 try
   points = [-1 0 ; 0 0 ; 1 0 ; 99 1 ; 99 0 ; 99 -1];
   toler = [3 3];
   Result = Preprocess(toler,points,3);
   Compare = [99 0 ; 0 0];
   if (Result == Compare)
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK'])
     testOk = testOk + 1;
   else
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail: Different result'])
     testFail = testFail + 1;
   end
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars

function TestIntersectionIdeal

 global testOk testFail maxChars
 dispString = 'IntersectionIdeal';
 try
   id1 = CoCoAIdeal([CoCoAPoly('0x+0y+0z+x') CoCoAPoly('0x+0y+0z+y')]);
   id2 = CoCoAIdeal([CoCoAPoly('0x+0y+0z+y^2') CoCoAPoly('0x+0y+0z+z')]);
   Result = IntersectionIdeal_wrap(id1,id2);
   Compare = [CoCoAPoly('0x+0y+0z+yz') CoCoAPoly('0x+0y+0z+xz') CoCoAPoly('0x+0y+0z+y^2')];
   if (Result == Compare)
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK'])
     testOk = testOk + 1;
   else
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail: Different result'])
     testFail = testFail + 1;
   end
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars

function TestSaturationIdeal

 global testOk testFail maxChars
 dispString = 'SaturationIdeal';
 try
   id1 = CoCoAIdeal([CoCoAPoly('0x+0y+x^2+y^2') CoCoAPoly('0x+0y+x^3-2y')]);
   id2 = CoCoAIdeal([CoCoAPoly('0x+0y+x') CoCoAPoly('0x+0y+y')]);
   Result = SaturationIdeal_wrap(id1,id2)
   Compare = [CoCoAPoly('0x+0y+xy+2') CoCoAPoly('0x+0y+x^2+y^2') CoCoAPoly('0x+0y+y^3-2x')];
   if (Result == Compare)
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK'])
     testOk = testOk + 1;
   else
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail: Different result'])
     testFail = testFail + 1;
   end
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars

function TestSSaturationIdeal

 global testOk testFail maxChars
 dispString = 'SSaturationIdeal';
 try
   id1 = CoCoAIdeal([CoCoAPoly('0x+0y+x^2+y^2') CoCoAPoly('0x+0y+x^3-2y')]);
   id2 = CoCoAIdeal([CoCoAPoly('0x+0y+x') CoCoAPoly('0x+0y+y')]);
   Result = SSaturationIdeal_wrap(id1,id2)
   Compare = [CoCoAPoly('0x+0y+xy+2') CoCoAPoly('0x+0y+x^2+y^2') CoCoAPoly('0x+0y+y^3-2x')];
   if (Result == Compare)
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK'])
     testOk = testOk + 1;
   else
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail: Different result'])
     testFail = testFail + 1;
   end
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars

function TestEliminationIdeal

 global testOk testFail maxChars
 dispString = 'EliminationIdeal';
 try
   myI = CoCoAIdeal([CoCoAPoly('0t+0x+0y+0z+t^15+t^6+t-x') CoCoAPoly('0t+0x+0y+0z+t^5-y') CoCoAPoly('0t+0x+0y+0z+t^3-z')]);
   ElimVar = [1 0 0 0]; % ElimVar = t
   Result = ElimIdeal_wrap(ElimVar,myI);
   Compare = [CoCoAPoly('0t+0x+0y+0z-z^5+y^3') CoCoAPoly('0t+0x+0y+0z-y^4-yz^2+xy-z^2') CoCoAPoly('0t+0x+0y+0z-xy^3z-y^2z^3-xz^3+x^2z-y^2-y') CoCoAPoly('0t+0x+0y+0z-y^2z^4-x^2y^3-xy^2z^2-yz^4-x^2z^2+x^3-y^2z-2yz-z') CoCoAPoly('0t+0x+0y+0z+y^3z^3-xz^3+y^3+y^2')];
   if (Result == Compare)
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK'])
     testOk = testOk + 1;
   else
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail: Different result'])
     testFail = testFail + 1;
   end
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars

function TestLeadingTermIdeal

 global testOk testFail maxChars
 dispString = 'LeadingTermIdeal';
 try
   Id1 = CoCoAIdeal([CoCoAPoly('0x+0y+0z+x^2+xz') CoCoAPoly('0x+0y+0z+xy') CoCoAPoly('0x+0y+0z+z')],1);
   Result = computeLT(Id1);
   Compare = [CoCoAPoly('0x+0y+z') CoCoAPoly('0x+0y+0z+xy') CoCoAPoly('0x+0y+0z+x^2')];
 
   if (Result == Compare) %#ok<BDSCI>
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK' ])
     testOk = testOk + 1;
   else
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail: Different result'])
     testFail = testFail + 1;
   end
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars
 

function TestIsElemIdeal

 global testOk testFail maxChars
 dispString = 'IsElemIdeal';
 try
   Id1 = CoCoAIdeal([CoCoAPoly('0x+0y+0z+x') CoCoAPoly('0x+0y+0z+xy')]);
   T1 = CoCoAPoly('0x+0y+0z+2x^2y');
   Result = IsElem(Id1,T1);
   Compare = 1;
 
   if (Result == Compare) %#ok<BDSCI>
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK' ])
     testOk = testOk + 1;
   else
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail: Different result'])
     testFail = testFail + 1;
   end
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars
 

function TestSyzygyIdeal

 global testOk testFail maxChars
 dispString = 'SyzygyIdeal';
 try
   Id = CoCoAIdeal([CoCoAPoly('x^2-y+0z') CoCoAPoly('xy-z') CoCoAPoly('xy+0z')]);
   Result = SyzygyIdeal_wrap(Id);
   Compare = [CoCoAPoly('0x+0y+0z+0') CoCoAPoly('xy+0z') CoCoAPoly('-xy+z') ; CoCoAPoly('0x+0y+z') CoCoAPoly('x^2-y+0z') CoCoAPoly('-x^2+y+0z') ; CoCoAPoly('xy+0z') CoCoAPoly('0x+0y+0z+0') CoCoAPoly('-x^2+y+0z') ; CoCoAPoly('0x+yz') CoCoAPoly('0x-y^2+0z') CoCoAPoly('0x+y^2-xz')];
   if (Result == Compare)
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'OK'])
     testOk = testOk + 1;
   else
     disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail: Different result'])
     testFail = testFail + 1;
   end
 catch
   disp([dispString ':' blanks(maxChars-length(dispString)-1) 'Fail'])
   testFail = testFail + 1;
   clear mex;
 end
 clear testOk testFail maxChars

</matlab>