Changeset 1740


Ignore:
Timestamp:
Jun 12, 2011 11:59:15 AM (8 years ago)
Author:
stefan
Message:

convert osi unittest to use new TestOutcomes? facility

Location:
trunk/Clp/test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/test/OsiClpSolverInterfaceTest.cpp

    r1663 r1740  
    55
    66#include "CoinPragma.hpp"
    7 
    87#include "OsiConfig.h"
    98
    10 #include <cassert>
     9//#include <cassert>
    1110//#include <cstdlib>
    1211//#include <cstdio>
     
    1716#include "OsiRowCut.hpp"
    1817#include "OsiColCut.hpp"
     18#include "OsiUnitTests.hpp"
    1919#include "CoinMessage.hpp"
    2020#include "ClpMessage.hpp"
     
    5151OsiClpSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir)
    5252{
    53  
     53
    5454  // Test default constructor
    5555  {
    5656    OsiClpSolverInterface m;
    57     assert( m.rowsense_==NULL );
    58     assert( m.rhs_==NULL );
    59     assert( m.rowrange_==NULL );
    60     assert( m.matrixByRow_==NULL );
    61     assert( m.ws_==NULL);
    62     assert( m.itlimOrig_==9999999);
    63     assert( m.lastAlgorithm_==0);
    64     assert( m.integerInformation_==NULL);
     57    OSIUNITTEST_ASSERT_ERROR(m.rowsense_           == NULL, {}, "clp", "default constructor");
     58    OSIUNITTEST_ASSERT_ERROR(m.rhs_                == NULL, {}, "clp", "default constructor");
     59    OSIUNITTEST_ASSERT_ERROR(m.rowrange_           == NULL, {}, "clp", "default constructor");
     60    OSIUNITTEST_ASSERT_ERROR(m.matrixByRow_        == NULL, {}, "clp", "default constructor");
     61    OSIUNITTEST_ASSERT_ERROR(m.ws_                 == NULL, {}, "clp", "default constructor");
     62    OSIUNITTEST_ASSERT_ERROR(m.itlimOrig_       == 9999999, {}, "clp", "default constructor");
     63    OSIUNITTEST_ASSERT_ERROR(m.lastAlgorithm_      == 0,    {}, "clp", "default constructor");
     64    OSIUNITTEST_ASSERT_ERROR(m.integerInformation_ == NULL, {}, "clp", "default constructor");
    6565  }
    66  
    67  
     66
    6867  {   
    6968    CoinRelFltEq eq;
     
    7574      OsiClpSolverInterface im;   
    7675     
    77       assert( im.getNumCols() == 0 );
    78      
    79       assert( im.getModelPtr()!=NULL );
     76      OSIUNITTEST_ASSERT_ERROR(im.getNumCols()  == 0,    {}, "clp", "default constructor");
     77      OSIUNITTEST_ASSERT_ERROR(im.getModelPtr() != NULL, {}, "clp", "default constructor");
     78
    8079      // Test reset
    8180      im.reset();
    82       assert( im.rowsense_==NULL );
    83       assert( im.rhs_==NULL );
    84       assert( im.rowrange_==NULL );
    85       assert( im.matrixByRow_==NULL );
    86       assert( im.ws_==NULL);
    87       assert( im.itlimOrig_==9999999);
    88       assert( im.lastAlgorithm_==0);
    89       assert( im.integerInformation_==NULL);
     81      OSIUNITTEST_ASSERT_ERROR(im.rowsense_           == NULL, {}, "clp", "reset");
     82      OSIUNITTEST_ASSERT_ERROR(im.rhs_                == NULL, {}, "clp", "reset");
     83      OSIUNITTEST_ASSERT_ERROR(im.rowrange_           == NULL, {}, "clp", "reset");
     84      OSIUNITTEST_ASSERT_ERROR(im.matrixByRow_        == NULL, {}, "clp", "reset");
     85      OSIUNITTEST_ASSERT_ERROR(im.ws_                 == NULL, {}, "clp", "reset");
     86      OSIUNITTEST_ASSERT_ERROR(im.itlimOrig_       == 9999999, {}, "clp", "reset");
     87      OSIUNITTEST_ASSERT_ERROR(im.lastAlgorithm_      ==    0, {}, "clp", "reset");
     88      OSIUNITTEST_ASSERT_ERROR(im.integerInformation_ == NULL, {}, "clp", "reset");
    9089    }
    9190   
     
    9796       
    9897        OsiClpSolverInterface imC1(im);
    99         assert( imC1.getModelPtr()!=im.getModelPtr() );
    100         assert( imC1.getNumCols() == im.getNumCols() );
    101         assert( imC1.getNumRows() == im.getNumRows() );   
     98        OSIUNITTEST_ASSERT_ERROR(imC1.getModelPtr() != im.getModelPtr(), {}, "clp", "copy constructor");
     99        OSIUNITTEST_ASSERT_ERROR(imC1.getNumCols()  == im.getNumCols(),  {}, "clp", "copy constructor");
     100        OSIUNITTEST_ASSERT_ERROR(imC1.getNumRows()  == im.getNumRows(),  {}, "clp", "copy constructor");
    102101       
    103102        OsiClpSolverInterface imC2(im);
    104         assert( imC2.getModelPtr()!=im.getModelPtr() );
    105         assert( imC2.getNumCols() == im.getNumCols() );
    106         assert( imC2.getNumRows() == im.getNumRows() ); 
     103        OSIUNITTEST_ASSERT_ERROR(imC2.getModelPtr() != im.getModelPtr(), {}, "clp", "copy constructor");
     104        OSIUNITTEST_ASSERT_ERROR(imC2.getNumCols()  == im.getNumCols(),  {}, "clp", "copy constructor");
     105        OSIUNITTEST_ASSERT_ERROR(imC2.getNumRows()  == im.getNumRows(),  {}, "clp", "copy constructor");
     106
     107        OSIUNITTEST_ASSERT_ERROR(imC1.getModelPtr() != imC2.getModelPtr(), {}, "clp", "copy constructor");
    107108       
    108         assert( imC2.getModelPtr()!=imC1.getModelPtr() );
    109        
    110         lhs=imC2;
    111       }
     109        lhs = imC2;
     110      }
     111
    112112      // Test that lhs has correct values even though rhs has gone out of scope
    113      
    114       assert( lhs.getModelPtr() != m.getModelPtr() );
    115       assert( lhs.getNumCols() == m.getNumCols() );
    116       assert( lhs.getNumRows() == m.getNumRows() );     
    117     }
     113      OSIUNITTEST_ASSERT_ERROR(lhs.getModelPtr() != m.getModelPtr(), {}, "clp", "assignment operator");
     114      OSIUNITTEST_ASSERT_ERROR(lhs.getNumCols()  == m.getNumCols(),  {}, "clp", "copy constructor");
     115      OSIUNITTEST_ASSERT_ERROR(lhs.getNumRows()  == m.getNumRows(),  {}, "clp", "copy constructor");
     116    }
     117
    118118    // Test clone
    119119    {
    120       OsiClpSolverInterface oslSi(m);
    121       OsiSolverInterface * siPtr = &oslSi;
     120      OsiClpSolverInterface clpSi(m);
     121      OsiSolverInterface * siPtr = &clpSi;
    122122      OsiSolverInterface * siClone = siPtr->clone();
    123       OsiClpSolverInterface * oslClone = dynamic_cast<OsiClpSolverInterface*>(siClone);
    124       assert( oslClone != NULL );
    125       assert( oslClone->getModelPtr() != oslSi.getModelPtr() );
    126       assert( oslClone->getNumRows() == oslSi.getNumRows() );
    127       assert( oslClone->getNumCols() == m.getNumCols() );
    128      
     123      OsiClpSolverInterface * clpClone = dynamic_cast<OsiClpSolverInterface*>(siClone);
     124     
     125      OSIUNITTEST_ASSERT_ERROR(clpClone != NULL, {}, "clp", "clone");
     126      OSIUNITTEST_ASSERT_ERROR(clpClone->getModelPtr() != clpSi.getModelPtr(), {}, "clp", "clone");
     127      OSIUNITTEST_ASSERT_ERROR(clpClone->getNumRows() == clpSi.getNumRows(),   {}, "clp", "clone");
     128      OSIUNITTEST_ASSERT_ERROR(clpClone->getNumCols() == m.getNumCols(),       {}, "clp", "clone");
     129
    129130      delete siClone;
    130131    }
    131132 
    132     // test infinity
     133    // Test infinity
    133134    {
    134135      OsiClpSolverInterface si;
    135       assert( eq(si.getInfinity(),OsiClpInfinity));
    136     }     
    137    
    138     // Test setting solution
    139     {
    140       OsiClpSolverInterface m1(m);
    141       int i;
    142 
    143       double * cs = new double[m1.getNumCols()];
    144       for ( i = 0;  i < m1.getNumCols();  i++ )
    145         cs[i] = i + .5;
    146       m1.setColSolution(cs);
    147       for ( i = 0;  i < m1.getNumCols();  i++ )
    148         assert(m1.getColSolution()[i] == i + .5);
    149      
    150       double * rs = new double[m1.getNumRows()];
    151       for ( i = 0;  i < m1.getNumRows();  i++ )
    152         rs[i] = i - .5;
    153       m1.setRowPrice(rs);
    154       for ( i = 0;  i < m1.getNumRows();  i++ )
    155         assert(m1.getRowPrice()[i] == i - .5);
    156 
    157       delete [] cs;
    158       delete [] rs;
    159     }
    160    
    161    
    162     // Test fraction Indices
    163     {
    164       OsiClpSolverInterface fim;
    165       std::string fn = mpsDir+"exmip1";
    166       fim.readMps(fn.c_str(),"mps");
    167       // exmip1.mps has 2 integer variables with index 2 & 3
    168       assert(  fim.isContinuous(0) );
    169       assert(  fim.isContinuous(1) );
    170       assert( !fim.isContinuous(2) );
    171       assert( !fim.isContinuous(3) );
    172       assert(  fim.isContinuous(4) );
    173      
    174       assert( !fim.isInteger(0) );
    175       assert( !fim.isInteger(1) );
    176       assert(  fim.isInteger(2) );
    177       assert(  fim.isInteger(3) );
    178       assert( !fim.isInteger(4) );
    179      
    180       assert( !fim.isBinary(0) );
    181       assert( !fim.isBinary(1) );
    182       assert(  fim.isBinary(2) );
    183       assert(  fim.isBinary(3) );
    184       assert( !fim.isBinary(4) );
    185      
    186       assert( !fim.isIntegerNonBinary(0) );
    187       assert( !fim.isIntegerNonBinary(1) );
    188       assert( !fim.isIntegerNonBinary(2) );
    189       assert( !fim.isIntegerNonBinary(3) );
    190       assert( !fim.isIntegerNonBinary(4) );
    191       // Test fractionalIndices
    192       {
    193         double sol[]={2.9,3.0};
    194         memcpy(fim.modelPtr_->primalColumnSolution()+2,sol,2*sizeof(double));
    195         OsiVectorInt fi = fim.getFractionalIndices(1e-5);
    196         assert( fi.size() == 1 );
    197         assert( fi[0]==2 );
    198        
    199         // Set integer variables very close to integer values
    200         sol[0]=5 + .00001/2.;
    201         sol[1]=8 - .00001/2.;
    202         memcpy(fim.modelPtr_->primalColumnSolution()+2,sol,2*sizeof(double));
    203         fi = fim.getFractionalIndices(1e-5);
    204         assert( fi.size() == 0 );
    205        
    206         // Set integer variables close, but beyond tolerances
    207         sol[0]=5 + .00001*2.;
    208         sol[1]=8 - .00001*2.;
    209         memcpy(fim.modelPtr_->primalColumnSolution()+2,sol,2*sizeof(double));
    210         fi = fim.getFractionalIndices(1e-5);
    211         assert( fi.size() == 2 );
    212         assert( fi[0]==2 );
    213         assert( fi[1]==3 );
    214       }
    215 
    216 
    217      
    218       // Change date so column 2 & 3 are integerNonBinary
    219       double ub[]={5.0,6.0};
    220       memcpy(fim.modelPtr_->columnUpper()+2,ub,2*sizeof(double));
    221       assert( !fim.isBinary(0) );
    222       assert( !fim.isBinary(1) );
    223       assert( !fim.isBinary(2) );
    224       assert( !fim.isBinary(3) );
    225       assert( !fim.isBinary(4) );
    226      
    227       assert( !fim.isIntegerNonBinary(0) );
    228       assert( !fim.isIntegerNonBinary(1) );
    229       assert(  fim.isIntegerNonBinary(2) );
    230       assert(  fim.isIntegerNonBinary(3) );
    231       assert( !fim.isIntegerNonBinary(4) );
    232     }
     136      OSIUNITTEST_ASSERT_ERROR(si.getInfinity() == OsiClpInfinity, {}, "clp", "infinity");
     137    }
     138   
    233139    // Test some catches
    234       if (!OsiClpHasNDEBUG())
     140    if (!OsiClpHasNDEBUG())
    235141    {
    236142      OsiClpSolverInterface solver;
    237 #ifndef NDEBUG  /* in optimized mode, the following code crashes */
    238143      try {
    239144        solver.setObjCoeff(0,0.0);
     145        OSIUNITTEST_ADD_OUTCOME("clp", "setObjCoeff on empty model", "should throw exception", OsiUnitTest::TestOutcome::ERROR, false);
    240146      }
    241147      catch (CoinError e) {
    242         std::cout<<"Correct throw"<<std::endl;
    243       }
    244 #endif
     148        if (OsiUnitTest::verbosity >= 1)
     149          std::cout<<"Correct throw from setObjCoeff on empty model"<<std::endl;
     150      }
     151
    245152      std::string fn = mpsDir+"exmip1";
    246153      solver.readMps(fn.c_str(),"mps");
    247       try {
    248         solver.setObjCoeff(0,0.0);
    249       }
    250       catch (CoinError e) {
    251         std::cout<<"** Incorrect throw"<<std::endl;
    252         abort();
    253       }
    254 #ifndef NDEBUG
     154      OSIUNITTEST_CATCH_ERROR(solver.setObjCoeff(0,0.0), {}, "clp", "setObjCoeff on nonempty model");
     155
    255156      try {
    256157        int index[]={0,20};
    257158        double value[]={0.0,0.0,0.0,0.0};
    258159        solver.setColSetBounds(index,index+2,value);
     160        OSIUNITTEST_ADD_OUTCOME("clp", "setColSetBounds on cols not in model", "should throw exception", OsiUnitTest::TestOutcome::ERROR, false);
    259161      }
    260162      catch (CoinError e) {
    261         std::cout<<"Correct throw"<<std::endl;
    262       }
    263 #endif
    264     }
    265     // Test apply cuts method
    266     {     
    267       OsiClpSolverInterface im(m);
    268       OsiCuts cuts;
    269      
    270       // Generate some cuts
    271       {
    272         // Get number of rows and columns in model
    273         int nr=im.getNumRows();
    274         int nc=im.getNumCols();
    275         assert( nr == 5 );
    276         assert( nc == 8 );
    277        
    278         // Generate a valid row cut from thin air
    279         int c;
    280         {
    281           int *inx = new int[nc];
    282           for (c=0;c<nc;c++) inx[c]=c;
    283           double *el = new double[nc];
    284           for (c=0;c<nc;c++) el[c]=((double)c)*((double)c);
    285          
    286           OsiRowCut rc;
    287           rc.setRow(nc,inx,el);
    288           rc.setLb(-100.);
    289           rc.setUb(100.);
    290           rc.setEffectiveness(22);
    291          
    292           cuts.insert(rc);
    293           delete[]el;
    294           delete[]inx;
    295         }
    296        
    297         // Generate valid col cut from thin air
    298         {
    299           const double * oslColLB = im.getColLower();
    300           const double * oslColUB = im.getColUpper();
    301           int *inx = new int[nc];
    302           for (c=0;c<nc;c++) inx[c]=c;
    303           double *lb = new double[nc];
    304           double *ub = new double[nc];
    305           for (c=0;c<nc;c++) lb[c]=oslColLB[c]+0.001;
    306           for (c=0;c<nc;c++) ub[c]=oslColUB[c]-0.001;
    307          
    308           OsiColCut cc;
    309           cc.setLbs(nc,inx,lb);
    310           cc.setUbs(nc,inx,ub);
    311          
    312           cuts.insert(cc);
    313           delete [] ub;
    314           delete [] lb;
    315           delete [] inx;
    316         }
    317        
    318         {
    319           // Generate a row and column cut which are ineffective
    320           OsiRowCut * rcP= new OsiRowCut;
    321           rcP->setEffectiveness(-1.);
    322           cuts.insert(rcP);
    323           assert(rcP==NULL);
    324          
    325           OsiColCut * ccP= new OsiColCut;
    326           ccP->setEffectiveness(-12.);
    327           cuts.insert(ccP);
    328           assert(ccP==NULL);
    329         }
    330         {
    331           //Generate inconsistent Row cut
    332           OsiRowCut rc;
    333           const int ne=1;
    334           int inx[ne]={-10};
    335           double el[ne]={2.5};
    336           rc.setRow(ne,inx,el);
    337           rc.setLb(3.);
    338           rc.setUb(4.);
    339           assert(!rc.consistent());
    340           cuts.insert(rc);
    341         }
    342         {
    343           //Generate inconsistent col cut
    344           OsiColCut cc;
    345           const int ne=1;
    346           int inx[ne]={-10};
    347           double el[ne]={2.5};
    348           cc.setUbs(ne,inx,el);
    349           assert(!cc.consistent());
    350           cuts.insert(cc);
    351         }
    352         {
    353           // Generate row cut which is inconsistent for model m
    354           OsiRowCut rc;
    355           const int ne=1;
    356           int inx[ne]={10};
    357           double el[ne]={2.5};
    358           rc.setRow(ne,inx,el);
    359           assert(rc.consistent());
    360           assert(!rc.consistent(im));
    361           cuts.insert(rc);
    362         }
    363         {
    364           // Generate col cut which is inconsistent for model m
    365           OsiColCut cc;
    366           const int ne=1;
    367           int inx[ne]={30};
    368           double el[ne]={2.0};
    369           cc.setLbs(ne,inx,el);
    370           assert(cc.consistent());
    371           assert(!cc.consistent(im));
    372           cuts.insert(cc);
    373         }
    374         {
    375           // Generate col cut which is infeasible
    376           OsiColCut cc;
    377           const int ne=1;
    378           int inx[ne]={0};
    379           double el[ne]={2.0};
    380           cc.setUbs(ne,inx,el);
    381           cc.setEffectiveness(1000.);
    382           assert(cc.consistent());
    383           assert(cc.consistent(im));
    384           assert(cc.infeasible(im));
    385           cuts.insert(cc);
    386         }
    387       }
    388       assert(cuts.sizeRowCuts()==4);
    389       assert(cuts.sizeColCuts()==5);
    390      
    391       OsiSolverInterface::ApplyCutsReturnCode rc = im.applyCuts(cuts);
    392       assert( rc.getNumIneffective() == 2 );
    393       assert( rc.getNumApplied() == 2 );
    394       assert( rc.getNumInfeasible() == 1 );
    395       assert( rc.getNumInconsistentWrtIntegerModel() == 2 );
    396       assert( rc.getNumInconsistent() == 2 );
    397       assert( cuts.sizeCuts() == rc.getNumIneffective() +
    398         rc.getNumApplied() +
    399         rc.getNumInfeasible() +
    400         rc.getNumInconsistentWrtIntegerModel() +
    401         rc.getNumInconsistent() );
    402     }
    403    
    404     {   
    405       OsiClpSolverInterface oslSi(m);
    406       int nc = oslSi.getNumCols();
    407       int nr = oslSi.getNumRows();
    408       const double * cl = oslSi.getColLower();
    409       const double * cu = oslSi.getColUpper();
    410       const double * rl = oslSi.getRowLower();
    411       const double * ru = oslSi.getRowUpper();
    412       assert( nc == 8 );
    413       assert( nr == 5 );
    414       assert( eq(cl[0],2.5) );
    415       assert( eq(cl[1],0.0) );
    416       assert( eq(cu[1],4.1) );
    417       assert( eq(cu[2],1.0) );
    418       assert( eq(rl[0],2.5) );
    419       assert( eq(rl[4],3.0) );
    420       assert( eq(ru[1],2.1) );
    421       assert( eq(ru[4],15.0) );
    422      
    423       const double * cs = oslSi.getColSolution();
    424       assert( eq(cs[0],2.5) );
    425       assert( eq(cs[7],0.0) );
    426      
    427       assert( !eq(cl[3],1.2345) );
    428       oslSi.setColLower( 3, 1.2345 );
    429       assert( eq(oslSi.getColLower()[3],1.2345) );
    430      
    431       assert( !eq(cu[4],10.2345) );
    432       oslSi.setColUpper( 4, 10.2345 );
    433       assert( eq(oslSi.getColUpper()[4],10.2345) );
    434 
    435       double objValue = oslSi.getObjValue();
    436       assert( eq(objValue,3.5) );
    437 
    438       assert( eq( oslSi.getObjCoefficients()[0],  1.0) );
    439       assert( eq( oslSi.getObjCoefficients()[1],  0.0) );
    440       assert( eq( oslSi.getObjCoefficients()[2],  0.0) );
    441       assert( eq( oslSi.getObjCoefficients()[3],  0.0) );
    442       assert( eq( oslSi.getObjCoefficients()[4],  2.0) );
    443       assert( eq( oslSi.getObjCoefficients()[5],  0.0) );
    444       assert( eq( oslSi.getObjCoefficients()[6],  0.0) );
    445       assert( eq( oslSi.getObjCoefficients()[7], -1.0) );
     163        if (OsiUnitTest::verbosity >= 1)
     164          std::cout<<"Correct throw from setObjCoeff on empty model"<<std::endl;
     165      }
     166    }
     167   
     168    {
     169      OsiClpSolverInterface clpSi(m);
     170      int nc = clpSi.getNumCols();
     171      int nr = clpSi.getNumRows();
     172      const double * cl = clpSi.getColLower();
     173      const double * cu = clpSi.getColUpper();
     174      const double * rl = clpSi.getRowLower();
     175      const double * ru = clpSi.getRowUpper();
     176      OSIUNITTEST_ASSERT_ERROR(nc == 8, return 1, "clp", "read and copy exmip1");
     177      OSIUNITTEST_ASSERT_ERROR(nr == 5, return 1, "clp", "read and copy exmip1");
     178      OSIUNITTEST_ASSERT_ERROR(eq(cl[0],2.5), {}, "clp", "read and copy exmip1");
     179      OSIUNITTEST_ASSERT_ERROR(eq(cl[1],0.0), {}, "clp", "read and copy exmip1");
     180      OSIUNITTEST_ASSERT_ERROR(eq(cu[1],4.1), {}, "clp", "read and copy exmip1");
     181      OSIUNITTEST_ASSERT_ERROR(eq(cu[2],1.0), {}, "clp", "read and copy exmip1");
     182      OSIUNITTEST_ASSERT_ERROR(eq(rl[0],2.5), {}, "clp", "read and copy exmip1");
     183      OSIUNITTEST_ASSERT_ERROR(eq(rl[4],3.0), {}, "clp", "read and copy exmip1");
     184      OSIUNITTEST_ASSERT_ERROR(eq(ru[1],2.1), {}, "clp", "read and copy exmip1");
     185      OSIUNITTEST_ASSERT_ERROR(eq(ru[4],15.), {}, "clp", "read and copy exmip1");
     186     
     187      const double * cs = clpSi.getColSolution();
     188      OSIUNITTEST_ASSERT_ERROR(eq(cs[0],2.5), {}, "clp", "read and copy exmip1");
     189      OSIUNITTEST_ASSERT_ERROR(eq(cs[7],0.0), {}, "clp", "read and copy exmip1");
     190     
     191      OSIUNITTEST_ASSERT_ERROR(!eq(cl[3],1.2345), {}, "clp", "set col lower");
     192      clpSi.setColLower( 3, 1.2345 );
     193      OSIUNITTEST_ASSERT_ERROR( eq(cl[3],1.2345), {}, "clp", "set col lower");
     194     
     195      OSIUNITTEST_ASSERT_ERROR(!eq(clpSi.getColUpper()[4],10.2345), {}, "clp", "set col upper");
     196      clpSi.setColUpper( 4, 10.2345 );
     197      OSIUNITTEST_ASSERT_ERROR( eq(clpSi.getColUpper()[4],10.2345), {}, "clp", "set col upper");
     198
     199      double objValue = clpSi.getObjValue();
     200      OSIUNITTEST_ASSERT_ERROR(eq(objValue,3.5), {}, "clp", "getObjValue() before solve");
     201
     202      OSIUNITTEST_ASSERT_ERROR(eq(clpSi.getObjCoefficients()[0], 1.0), {}, "clp", "read and copy exmip1");
     203      OSIUNITTEST_ASSERT_ERROR(eq(clpSi.getObjCoefficients()[1], 0.0), {}, "clp", "read and copy exmip1");
     204      OSIUNITTEST_ASSERT_ERROR(eq(clpSi.getObjCoefficients()[2], 0.0), {}, "clp", "read and copy exmip1");
     205      OSIUNITTEST_ASSERT_ERROR(eq(clpSi.getObjCoefficients()[3], 0.0), {}, "clp", "read and copy exmip1");
     206      OSIUNITTEST_ASSERT_ERROR(eq(clpSi.getObjCoefficients()[4], 2.0), {}, "clp", "read and copy exmip1");
     207      OSIUNITTEST_ASSERT_ERROR(eq(clpSi.getObjCoefficients()[5], 0.0), {}, "clp", "read and copy exmip1");
     208      OSIUNITTEST_ASSERT_ERROR(eq(clpSi.getObjCoefficients()[6], 0.0), {}, "clp", "read and copy exmip1");
     209      OSIUNITTEST_ASSERT_ERROR(eq(clpSi.getObjCoefficients()[7],-1.0), {}, "clp", "read and copy exmip1");
    446210    }
    447211   
    448212    // Test matrixByRow method
    449     { 
     213    {
    450214      const OsiClpSolverInterface si(m);
    451215      const CoinPackedMatrix * smP = si.getMatrixByRow();
    452       // LL:      const OsiClpPackedMatrix * osmP = dynamic_cast<const OsiClpPackedMatrix*>(smP);
    453       // LL: assert( osmP!=NULL );
    454      
     216
     217      OSIUNITTEST_ASSERT_ERROR(smP->getMajorDim()    ==  5, return 1, "clp", "getMatrixByRow: major dim");
     218      OSIUNITTEST_ASSERT_ERROR(smP->getNumElements() == 14, return 1, "clp", "getMatrixByRow: num elements");
     219
    455220      CoinRelFltEq eq;
    456221      const double * ev = smP->getElements();
    457       assert( eq(ev[0],   3.0) );
    458       assert( eq(ev[1],   1.0) );
    459       assert( eq(ev[2],  -2.0) );
    460       assert( eq(ev[3],  -1.0) );
    461       assert( eq(ev[4],  -1.0) );
    462       assert( eq(ev[5],   2.0) );
    463       assert( eq(ev[6],   1.1) );
    464       assert( eq(ev[7],   1.0) );
    465       assert( eq(ev[8],   1.0) );
    466       assert( eq(ev[9],   2.8) );
    467       assert( eq(ev[10], -1.2) );
    468       assert( eq(ev[11],  5.6) );
    469       assert( eq(ev[12],  1.0) );
    470       assert( eq(ev[13],  1.9) );
    471      
    472       const CoinBigIndex * mi = smP->getVectorStarts();
    473       assert( mi[0]==0 );
    474       assert( mi[1]==5 );
    475       assert( mi[2]==7 );
    476       assert( mi[3]==9 );
    477       assert( mi[4]==11 );
    478       assert( mi[5]==14 );
     222      OSIUNITTEST_ASSERT_ERROR(eq(ev[0],   3.0), {}, "clp", "getMatrixByRow: elements");
     223      OSIUNITTEST_ASSERT_ERROR(eq(ev[1],   1.0), {}, "clp", "getMatrixByRow: elements");
     224      OSIUNITTEST_ASSERT_ERROR(eq(ev[2],  -2.0), {}, "clp", "getMatrixByRow: elements");
     225      OSIUNITTEST_ASSERT_ERROR(eq(ev[3],  -1.0), {}, "clp", "getMatrixByRow: elements");
     226      OSIUNITTEST_ASSERT_ERROR(eq(ev[4],  -1.0), {}, "clp", "getMatrixByRow: elements");
     227      OSIUNITTEST_ASSERT_ERROR(eq(ev[5],   2.0), {}, "clp", "getMatrixByRow: elements");
     228      OSIUNITTEST_ASSERT_ERROR(eq(ev[6],   1.1), {}, "clp", "getMatrixByRow: elements");
     229      OSIUNITTEST_ASSERT_ERROR(eq(ev[7],   1.0), {}, "clp", "getMatrixByRow: elements");
     230      OSIUNITTEST_ASSERT_ERROR(eq(ev[8],   1.0), {}, "clp", "getMatrixByRow: elements");
     231      OSIUNITTEST_ASSERT_ERROR(eq(ev[9],   2.8), {}, "clp", "getMatrixByRow: elements");
     232      OSIUNITTEST_ASSERT_ERROR(eq(ev[10], -1.2), {}, "clp", "getMatrixByRow: elements");
     233      OSIUNITTEST_ASSERT_ERROR(eq(ev[11],  5.6), {}, "clp", "getMatrixByRow: elements");
     234      OSIUNITTEST_ASSERT_ERROR(eq(ev[12],  1.0), {}, "clp", "getMatrixByRow: elements");
     235      OSIUNITTEST_ASSERT_ERROR(eq(ev[13],  1.9), {}, "clp", "getMatrixByRow: elements");
     236     
     237      const int * mi = smP->getVectorStarts();
     238      OSIUNITTEST_ASSERT_ERROR(mi[0] ==  0, {}, "clp", "getMatrixByRow: vector starts");
     239      OSIUNITTEST_ASSERT_ERROR(mi[1] ==  5, {}, "clp", "getMatrixByRow: vector starts");
     240      OSIUNITTEST_ASSERT_ERROR(mi[2] ==  7, {}, "clp", "getMatrixByRow: vector starts");
     241      OSIUNITTEST_ASSERT_ERROR(mi[3] ==  9, {}, "clp", "getMatrixByRow: vector starts");
     242      OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "clp", "getMatrixByRow: vector starts");
     243      OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "clp", "getMatrixByRow: vector starts");
    479244     
    480245      const int * ei = smP->getIndices();
    481       assert( ei[0]  ==  0 );
    482       assert( ei[1]  ==  1 );
    483       assert( ei[2]  ==  3 );
    484       assert( ei[3]  ==  4 );
    485       assert( ei[4]  ==  7 );
    486       assert( ei[5]  ==  1 );
    487       assert( ei[6]  ==  2 );
    488       assert( ei[7]  ==  2 );
    489       assert( ei[8]  ==  5 );
    490       assert( ei[9]  ==  3 );
    491       assert( ei[10] ==  6 );
    492       assert( ei[11] ==  0 );
    493       assert( ei[12] ==  4 );
    494       assert( ei[13] ==  7 );   
    495      
    496       assert( smP->getMajorDim() == 5 );
    497       assert( smP->getNumElements() == 14 );
    498      
    499     }
     246      OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "clp", "getMatrixByRow: indices");
     247      OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "clp", "getMatrixByRow: indices");
     248      OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "clp", "getMatrixByRow: indices");
     249      OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "clp", "getMatrixByRow: indices");
     250      OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "clp", "getMatrixByRow: indices");
     251      OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "clp", "getMatrixByRow: indices");
     252      OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "clp", "getMatrixByRow: indices");
     253      OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "clp", "getMatrixByRow: indices");
     254      OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "clp", "getMatrixByRow: indices");
     255      OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "clp", "getMatrixByRow: indices");
     256      OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "clp", "getMatrixByRow: indices");
     257      OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "clp", "getMatrixByRow: indices");
     258      OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "clp", "getMatrixByRow: indices");
     259      OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "clp", "getMatrixByRow: indices");
     260    }
     261
    500262    // Test adding several cuts
    501263    {
     
    506268      fim.initialSolve();
    507269      OsiRowCut cuts[3];
    508      
    509      
     270
    510271      // Generate one ineffective cut plus two trivial cuts
    511272      int c;
     
    539300      const double * cs = fim.getColSolution();
    540301      CoinRelFltEq eq;
    541       assert( eq(cs[2],   1.0) );
    542       assert( eq(cs[3],   1.0) );
     302      OSIUNITTEST_ASSERT_ERROR(eq(cs[2], 1.0), {}, "clp", "add cuts");
     303      OSIUNITTEST_ASSERT_ERROR(eq(cs[3], 1.0), {}, "clp", "add cuts");
    543304      // check will find invalid matrix
    544305      el[0]=1.0/el[4];
     
    551312      // resolve - should get message about zero elements
    552313      fim.resolve();
    553       assert (fim.isAbandoned());
     314      OSIUNITTEST_ASSERT_WARNING(fim.isAbandoned(), {}, "clp", "add cuts");
    554315      delete[]el;
    555316      delete[]inx;
    556317    }
     318
    557319    // Test using bad basis
    558320    {
     
    566328      int * columnStatus = new int[numberColumns];
    567329      fim.getBasisStatus(columnStatus,rowStatus);
    568       int i;
    569       for (i=0;i<numberRows;i++) {
     330      for (int i=0; i<numberRows; i++)
    570331        rowStatus[i]=2;
    571       }       
    572332      fim.setBasisStatus(columnStatus,rowStatus);
    573333      fim.resolve();
     
    575335      delete [] columnStatus;
    576336    }
    577         // Test matrixByCol method
     337
     338    // Test matrixByCol method
    578339    {
    579340 
    580341      const OsiClpSolverInterface si(m);
    581342      const CoinPackedMatrix * smP = si.getMatrixByCol();
    582       // LL:      const OsiClpPackedMatrix * osmP = dynamic_cast<const OsiClpPackedMatrix*>(smP);
    583       // LL: assert( osmP!=NULL );
    584      
     343     
     344      OSIUNITTEST_ASSERT_ERROR(smP->getMajorDim()    ==  8, return 1, "clp", "getMatrixByCol: major dim");
     345      OSIUNITTEST_ASSERT_ERROR(smP->getMinorDim()    ==  5, return 1, "clp", "getMatrixByCol: minor dim");
     346      OSIUNITTEST_ASSERT_ERROR(smP->getNumElements() == 14, return 1, "clp", "getMatrixByCol: number of elements");
     347      OSIUNITTEST_ASSERT_ERROR(smP->getSizeVectorStarts() == 9, return 1, "clp", "getMatrixByCol: vector starts size");
     348
    585349      CoinRelFltEq eq;
    586350      const double * ev = smP->getElements();
    587       assert( eq(ev[0],   3.0) );
    588       assert( eq(ev[1],   5.6) );
    589       assert( eq(ev[2],   1.0) );
    590       assert( eq(ev[3],   2.0) );
    591       assert( eq(ev[4],   1.1) );
    592       assert( eq(ev[5],   1.0) );
    593       assert( eq(ev[6],  -2.0) );
    594       assert( eq(ev[7],   2.8) );
    595       assert( eq(ev[8],  -1.0) );
    596       assert( eq(ev[9],   1.0) );
    597       assert( eq(ev[10],  1.0) );
    598       assert( eq(ev[11], -1.2) );
    599       assert( eq(ev[12], -1.0) );
    600       assert( eq(ev[13],  1.9) );
     351      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "clp", "getMatrixByCol: elements");
     352      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 5.6), {}, "clp", "getMatrixByCol: elements");
     353      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2], 1.0), {}, "clp", "getMatrixByCol: elements");
     354      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3], 2.0), {}, "clp", "getMatrixByCol: elements");
     355      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4], 1.1), {}, "clp", "getMatrixByCol: elements");
     356      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 1.0), {}, "clp", "getMatrixByCol: elements");
     357      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6],-2.0), {}, "clp", "getMatrixByCol: elements");
     358      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 2.8), {}, "clp", "getMatrixByCol: elements");
     359      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8],-1.0), {}, "clp", "getMatrixByCol: elements");
     360      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 1.0), {}, "clp", "getMatrixByCol: elements");
     361      OSIUNITTEST_ASSERT_ERROR(eq(ev[10], 1.0), {}, "clp", "getMatrixByCol: elements");
     362      OSIUNITTEST_ASSERT_ERROR(eq(ev[11],-1.2), {}, "clp", "getMatrixByCol: elements");
     363      OSIUNITTEST_ASSERT_ERROR(eq(ev[12],-1.0), {}, "clp", "getMatrixByCol: elements");
     364      OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "clp", "getMatrixByCol: elements");
    601365     
    602366      const CoinBigIndex * mi = smP->getVectorStarts();
    603       assert( mi[0]==0 );
    604       assert( mi[1]==2 );
    605       assert( mi[2]==4 );
    606       assert( mi[3]==6 );
    607       assert( mi[4]==8 );
    608       assert( mi[5]==10 );
    609       assert( mi[6]==11 );
    610       assert( mi[7]==12 );
    611       assert( mi[8]==14 );
     367      OSIUNITTEST_ASSERT_ERROR(mi[0] ==  0, {}, "clp", "getMatrixByCol: vector starts");
     368      OSIUNITTEST_ASSERT_ERROR(mi[1] ==  2, {}, "clp", "getMatrixByCol: vector starts");
     369      OSIUNITTEST_ASSERT_ERROR(mi[2] ==  4, {}, "clp", "getMatrixByCol: vector starts");
     370      OSIUNITTEST_ASSERT_ERROR(mi[3] ==  6, {}, "clp", "getMatrixByCol: vector starts");
     371      OSIUNITTEST_ASSERT_ERROR(mi[4] ==  8, {}, "clp", "getMatrixByCol: vector starts");
     372      OSIUNITTEST_ASSERT_ERROR(mi[5] == 10, {}, "clp", "getMatrixByCol: vector starts");
     373      OSIUNITTEST_ASSERT_ERROR(mi[6] == 11, {}, "clp", "getMatrixByCol: vector starts");
     374      OSIUNITTEST_ASSERT_ERROR(mi[7] == 12, {}, "clp", "getMatrixByCol: vector starts");
     375      OSIUNITTEST_ASSERT_ERROR(mi[8] == 14, {}, "clp", "getMatrixByCol: vector starts");
    612376     
    613377      const int * ei = smP->getIndices();
    614       assert( ei[0]  ==  0 );
    615       assert( ei[1]  ==  4 );
    616       assert( ei[2]  ==  0 );
    617       assert( ei[3]  ==  1 );
    618       assert( ei[4]  ==  1 );
    619       assert( ei[5]  ==  2 );
    620       assert( ei[6]  ==  0 );
    621       assert( ei[7]  ==  3 );
    622       assert( ei[8]  ==  0 );
    623       assert( ei[9]  ==  4 );
    624       assert( ei[10] ==  2 );
    625       assert( ei[11] ==  3 );
    626       assert( ei[12] ==  0 );
    627       assert( ei[13] ==  4 );   
    628      
    629       assert( smP->getMajorDim() == 8 );
    630       assert( smP->getNumElements() == 14 );
    631 
    632       assert( smP->getSizeVectorStarts()==9 );
    633       assert( smP->getMinorDim() == 5 );
    634      
    635     }
     378      OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "clp", "getMatrixByCol: indices");
     379      OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 4, {}, "clp", "getMatrixByCol: indices");
     380      OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 0, {}, "clp", "getMatrixByCol: indices");
     381      OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 1, {}, "clp", "getMatrixByCol: indices");
     382      OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 1, {}, "clp", "getMatrixByCol: indices");
     383      OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 2, {}, "clp", "getMatrixByCol: indices");
     384      OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 0, {}, "clp", "getMatrixByCol: indices");
     385      OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 3, {}, "clp", "getMatrixByCol: indices");
     386      OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 0, {}, "clp", "getMatrixByCol: indices");
     387      OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 4, {}, "clp", "getMatrixByCol: indices");
     388      OSIUNITTEST_ASSERT_ERROR(ei[10] == 2, {}, "clp", "getMatrixByCol: indices");
     389      OSIUNITTEST_ASSERT_ERROR(ei[11] == 3, {}, "clp", "getMatrixByCol: indices");
     390      OSIUNITTEST_ASSERT_ERROR(ei[12] == 0, {}, "clp", "getMatrixByCol: indices");
     391      OSIUNITTEST_ASSERT_ERROR(ei[13] == 4, {}, "clp", "getMatrixByCol: indices");
     392    }
     393
    636394    //--------------
    637395    // Test rowsense, rhs, rowrange, matrixByRow
     
    639397      OsiClpSolverInterface lhs;
    640398      {     
    641         assert( m.rowrange_==NULL );
    642         assert( m.rowsense_==NULL );
    643         assert( m.rhs_==NULL );
    644         assert( m.matrixByRow_==NULL );
    645        
    646         OsiClpSolverInterface siC1(m);     
    647         assert( siC1.rowrange_==NULL );
    648         assert( siC1.rowsense_==NULL );
    649         assert( siC1.rhs_==NULL );
    650         assert( siC1.matrixByRow_==NULL );
     399        OsiClpSolverInterface siC1(m);
     400        OSIUNITTEST_ASSERT_WARNING(siC1.rowrange_ == NULL, {}, "clp", "row range");
     401        OSIUNITTEST_ASSERT_WARNING(siC1.rowsense_ == NULL, {}, "clp", "row sense");
     402        OSIUNITTEST_ASSERT_WARNING(siC1.rhs_ == NULL, {}, "clp", "right hand side");
     403        OSIUNITTEST_ASSERT_WARNING(siC1.matrixByRow_ == NULL, {}, "clp", "matrix by row");
    651404
    652405        const char   * siC1rs  = siC1.getRowSense();
    653         assert( siC1rs[0]=='G' );
    654         assert( siC1rs[1]=='L' );
    655         assert( siC1rs[2]=='E' );
    656         assert( siC1rs[3]=='R' );
    657         assert( siC1rs[4]=='R' );
    658        
     406        OSIUNITTEST_ASSERT_ERROR(siC1rs[0] == 'G', {}, "clp", "row sense");
     407        OSIUNITTEST_ASSERT_ERROR(siC1rs[1] == 'L', {}, "clp", "row sense");
     408        OSIUNITTEST_ASSERT_ERROR(siC1rs[2] == 'E', {}, "clp", "row sense");
     409        OSIUNITTEST_ASSERT_ERROR(siC1rs[3] == 'R', {}, "clp", "row sense");
     410        OSIUNITTEST_ASSERT_ERROR(siC1rs[4] == 'R', {}, "clp", "row sense");
     411
    659412        const double * siC1rhs = siC1.getRightHandSide();
    660         assert( eq(siC1rhs[0],2.5) );
    661         assert( eq(siC1rhs[1],2.1) );
    662         assert( eq(siC1rhs[2],4.0) );
    663         assert( eq(siC1rhs[3],5.0) );
    664         assert( eq(siC1rhs[4],15.) );
    665        
     413        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[0],2.5), {}, "clp", "right hand side");
     414        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[1],2.1), {}, "clp", "right hand side");
     415        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[2],4.0), {}, "clp", "right hand side");
     416        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[3],5.0), {}, "clp", "right hand side");
     417        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[4],15.), {}, "clp", "right hand side");
     418
    666419        const double * siC1rr  = siC1.getRowRange();
    667         assert( eq(siC1rr[0],0.0) );
    668         assert( eq(siC1rr[1],0.0) );
    669         assert( eq(siC1rr[2],0.0) );
    670         assert( eq(siC1rr[3],5.0-1.8) );
    671         assert( eq(siC1rr[4],15.0-3.0) );
    672        
     420        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[0],0.0), {}, "clp", "row range");
     421        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[1],0.0), {}, "clp", "row range");
     422        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[2],0.0), {}, "clp", "row range");
     423        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[3],5.0-1.8), {}, "clp", "row range");
     424        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[4],15.0-3.0), {}, "clp", "row range");
     425
    673426        const CoinPackedMatrix * siC1mbr = siC1.getMatrixByRow();
    674         assert( siC1mbr != NULL );
    675        
     427        OSIUNITTEST_ASSERT_ERROR(siC1mbr != NULL, {}, "clp", "matrix by row");
     428        OSIUNITTEST_ASSERT_ERROR(siC1mbr->getMajorDim()    ==  5, return 1, "clp", "matrix by row: major dim");
     429        OSIUNITTEST_ASSERT_ERROR(siC1mbr->getNumElements() == 14, return 1, "clp", "matrix by row: num elements");
     430
    676431        const double * ev = siC1mbr->getElements();
    677         assert( eq(ev[0],   3.0) );
    678         assert( eq(ev[1],   1.0) );
    679         assert( eq(ev[2],  -2.0) );
    680         assert( eq(ev[3],  -1.0) );
    681         assert( eq(ev[4],  -1.0) );
    682         assert( eq(ev[5],   2.0) );
    683         assert( eq(ev[6],   1.1) );
    684         assert( eq(ev[7],   1.0) );
    685         assert( eq(ev[8],   1.0) );
    686         assert( eq(ev[9],   2.8) );
    687         assert( eq(ev[10], -1.2) );
    688         assert( eq(ev[11],  5.6) );
    689         assert( eq(ev[12],  1.0) );
    690         assert( eq(ev[13],  1.9) );
    691        
     432        OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "clp", "matrix by row: elements");
     433        OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 1.0), {}, "clp", "matrix by row: elements");
     434        OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2],-2.0), {}, "clp", "matrix by row: elements");
     435        OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3],-1.0), {}, "clp", "matrix by row: elements");
     436        OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4],-1.0), {}, "clp", "matrix by row: elements");
     437        OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 2.0), {}, "clp", "matrix by row: elements");
     438        OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6], 1.1), {}, "clp", "matrix by row: elements");
     439        OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 1.0), {}, "clp", "matrix by row: elements");
     440        OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8], 1.0), {}, "clp", "matrix by row: elements");
     441        OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 2.8), {}, "clp", "matrix by row: elements");
     442        OSIUNITTEST_ASSERT_ERROR(eq(ev[10],-1.2), {}, "clp", "matrix by row: elements");
     443        OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "clp", "matrix by row: elements");
     444        OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "clp", "matrix by row: elements");
     445        OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "clp", "matrix by row: elements");
     446
    692447        const CoinBigIndex * mi = siC1mbr->getVectorStarts();
    693         assert( mi[0]==0 );
    694         assert( mi[1]==5 );
    695         assert( mi[2]==7 );
    696         assert( mi[3]==9 );
    697         assert( mi[4]==11 );
    698         assert( mi[5]==14 );
    699        
     448        OSIUNITTEST_ASSERT_ERROR(mi[0] ==  0, {}, "clp", "matrix by row: vector starts");
     449        OSIUNITTEST_ASSERT_ERROR(mi[1] ==  5, {}, "clp", "matrix by row: vector starts");
     450        OSIUNITTEST_ASSERT_ERROR(mi[2] ==  7, {}, "clp", "matrix by row: vector starts");
     451        OSIUNITTEST_ASSERT_ERROR(mi[3] ==  9, {}, "clp", "matrix by row: vector starts");
     452        OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "clp", "matrix by row: vector starts");
     453        OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "clp", "matrix by row: vector starts");
     454
    700455        const int * ei = siC1mbr->getIndices();
    701         assert( ei[0]  ==  0 );
    702         assert( ei[1]  ==  1 );
    703         assert( ei[2]  ==  3 );
    704         assert( ei[3]  ==  4 );
    705         assert( ei[4]  ==  7 );
    706         assert( ei[5]  ==  1 );
    707         assert( ei[6]  ==  2 );
    708         assert( ei[7]  ==  2 );
    709         assert( ei[8]  ==  5 );
    710         assert( ei[9]  ==  3 );
    711         assert( ei[10] ==  6 );
    712         assert( ei[11] ==  0 );
    713         assert( ei[12] ==  4 );
    714         assert( ei[13] ==  7 );   
    715        
    716         assert( siC1mbr->getMajorDim() == 5 );
    717         assert( siC1mbr->getNumElements() == 14 );
    718        
    719 
    720         assert( siC1rs  == siC1.getRowSense() );
    721         assert( siC1rhs == siC1.getRightHandSide() );
    722         assert( siC1rr  == siC1.getRowRange() );
    723 
    724         // Change OSL Model by adding free row
     456        OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "clp", "matrix by row: indices");
     457        OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "clp", "matrix by row: indices");
     458        OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "clp", "matrix by row: indices");
     459        OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "clp", "matrix by row: indices");
     460        OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "clp", "matrix by row: indices");
     461        OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "clp", "matrix by row: indices");
     462        OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "clp", "matrix by row: indices");
     463        OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "clp", "matrix by row: indices");
     464        OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "clp", "matrix by row: indices");
     465        OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "clp", "matrix by row: indices");
     466        OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "clp", "matrix by row: indices");
     467        OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "clp", "matrix by row: indices");
     468        OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "clp", "matrix by row: indices");
     469        OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "clp", "matrix by row: indices");
     470
     471        OSIUNITTEST_ASSERT_WARNING(siC1rs  == siC1.getRowSense(), {}, "clp", "row sense");
     472        OSIUNITTEST_ASSERT_WARNING(siC1rhs == siC1.getRightHandSide(), {}, "clp", "right hand side");
     473        OSIUNITTEST_ASSERT_WARNING(siC1rr  == siC1.getRowRange(), {}, "clp", "row range");
     474
     475        // Change CLP Model by adding free row
    725476        OsiRowCut rc;
    726         rc.setLb(-DBL_MAX);
    727         rc.setUb( DBL_MAX);
     477        rc.setLb(-COIN_DBL_MAX);
     478        rc.setUb( COIN_DBL_MAX);
    728479        OsiCuts cuts;
    729480        cuts.insert(rc);
    730481        siC1.applyCuts(cuts);
    731              
    732         // Since model was changed, test that cached
    733         // data is now freed.
    734         assert( siC1.rowrange_==NULL );
    735         assert( siC1.rowsense_==NULL );
    736         assert( siC1.rhs_==NULL );
    737         // now updated! assert( siC1.matrixByRow_==NULL );
    738        
     482
     483        // Since model was changed, test that cached data is now freed.
     484        OSIUNITTEST_ASSERT_ERROR(siC1.rowrange_ == NULL, {}, "clp", "free cached data after adding row");
     485        OSIUNITTEST_ASSERT_ERROR(siC1.rowsense_ == NULL, {}, "clp", "free cached data after adding row");
     486        OSIUNITTEST_ASSERT_ERROR(siC1.rhs_ == NULL, {}, "clp", "free cached data after adding row");
     487        // siC1.matrixByRow_ is updated, so it does not have to be NULL
     488
    739489        siC1rs  = siC1.getRowSense();
    740         assert( siC1rs[0]=='G' );
    741         assert( siC1rs[1]=='L' );
    742         assert( siC1rs[2]=='E' );
    743         assert( siC1rs[3]=='R' );
    744         assert( siC1rs[4]=='R' );
    745         assert( siC1rs[5]=='N' );
     490        OSIUNITTEST_ASSERT_ERROR(siC1rs[0] == 'G', {}, "clp", "row sense after adding row");
     491        OSIUNITTEST_ASSERT_ERROR(siC1rs[1] == 'L', {}, "clp", "row sense after adding row");
     492        OSIUNITTEST_ASSERT_ERROR(siC1rs[2] == 'E', {}, "clp", "row sense after adding row");
     493        OSIUNITTEST_ASSERT_ERROR(siC1rs[3] == 'R', {}, "clp", "row sense after adding row");
     494        OSIUNITTEST_ASSERT_ERROR(siC1rs[4] == 'R', {}, "clp", "row sense after adding row");
     495        OSIUNITTEST_ASSERT_ERROR(siC1rs[5] == 'N', {}, "clp", "row sense after adding row");
    746496
    747497        siC1rhs = siC1.getRightHandSide();
    748         assert( eq(siC1rhs[0],2.5) );
    749         assert( eq(siC1rhs[1],2.1) );
    750         assert( eq(siC1rhs[2],4.0) );
    751         assert( eq(siC1rhs[3],5.0) );
    752         assert( eq(siC1rhs[4],15.) );
    753         assert( eq(siC1rhs[5],0.0 ) );
     498        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[0],2.5), {}, "clp", "right hand side after adding row");
     499        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[1],2.1), {}, "clp", "right hand side after adding row");
     500        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[2],4.0), {}, "clp", "right hand side after adding row");
     501        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[3],5.0), {}, "clp", "right hand side after adding row");
     502        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[4],15.), {}, "clp", "right hand side after adding row");
     503        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[5],0.0), {}, "clp", "right hand side after adding row");
    754504
    755505        siC1rr  = siC1.getRowRange();
    756         assert( eq(siC1rr[0],0.0) );
    757         assert( eq(siC1rr[1],0.0) );
    758         assert( eq(siC1rr[2],0.0) );
    759         assert( eq(siC1rr[3],5.0-1.8) );
    760         assert( eq(siC1rr[4],15.0-3.0) );
    761         assert( eq(siC1rr[5],0.0) );
    762    
    763         lhs=siC1;
    764       }
    765       // Test that lhs has correct values even though siC1 has gone out of scope   
    766       assert( lhs.rowrange_==NULL );
    767       assert( lhs.rowsense_==NULL );
    768       assert( lhs.rhs_==NULL );
    769       assert( lhs.matrixByRow_==NULL );
    770      
     506        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[0],0.0), {}, "clp", "row range after adding row");
     507        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[1],0.0), {}, "clp", "row range after adding row");
     508        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[2],0.0), {}, "clp", "row range after adding row");
     509        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[3],5.0-1.8), {}, "clp", "row range after adding row");
     510        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[4],15.0-3.0), {}, "clp", "row range after adding row");
     511        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[5],0.0), {}, "clp", "row range after adding row");
     512
     513        lhs = siC1;
     514      }
     515      // Test that lhs has correct values even though siC1 has gone out of scope
     516      OSIUNITTEST_ASSERT_ERROR(lhs.rowrange_ == NULL, {}, "clp", "freed origin after assignment");
     517      OSIUNITTEST_ASSERT_ERROR(lhs.rowsense_ == NULL, {}, "clp", "freed origin after assignment");
     518      OSIUNITTEST_ASSERT_ERROR(lhs.rhs_ == NULL, {}, "clp", "freed origin after assignment");
     519      OSIUNITTEST_ASSERT_ERROR(lhs.matrixByRow_ == NULL, {}, "clp", "freed origin after assignment");
     520
    771521      const char * lhsrs  = lhs.getRowSense();
    772       assert( lhsrs[0]=='G' );
    773       assert( lhsrs[1]=='L' );
    774       assert( lhsrs[2]=='E' );
    775       assert( lhsrs[3]=='R' );
    776       assert( lhsrs[4]=='R' );
    777       assert( lhsrs[5]=='N' );
     522      OSIUNITTEST_ASSERT_ERROR(lhsrs[0] == 'G', {}, "clp", "row sense after assignment");
     523      OSIUNITTEST_ASSERT_ERROR(lhsrs[1] == 'L', {}, "clp", "row sense after assignment");
     524      OSIUNITTEST_ASSERT_ERROR(lhsrs[2] == 'E', {}, "clp", "row sense after assignment");
     525      OSIUNITTEST_ASSERT_ERROR(lhsrs[3] == 'R', {}, "clp", "row sense after assignment");
     526      OSIUNITTEST_ASSERT_ERROR(lhsrs[4] == 'R', {}, "clp", "row sense after assignment");
     527      OSIUNITTEST_ASSERT_ERROR(lhsrs[5] == 'N', {}, "clp", "row sense after assignment");
    778528     
    779529      const double * lhsrhs = lhs.getRightHandSide();
    780       assert( eq(lhsrhs[0],2.5) );
    781       assert( eq(lhsrhs[1],2.1) );
    782       assert( eq(lhsrhs[2],4.0) );
    783       assert( eq(lhsrhs[3],5.0) );
    784       assert( eq(lhsrhs[4],15.) );
    785       assert( eq(lhsrhs[5],0.0) );
    786      
    787       const double *lhsrr  = lhs.getRowRange();
    788       assert( eq(lhsrr[0],0.0) );
    789       assert( eq(lhsrr[1],0.0) );
    790       assert( eq(lhsrr[2],0.0) );
    791       assert( eq(lhsrr[3],5.0-1.8) );
    792       assert( eq(lhsrr[4],15.0-3.0) );
    793       assert( eq(lhsrr[5],0.0) );     
     530      OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[0],2.5), {}, "clp", "right hand side after assignment");
     531      OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[1],2.1), {}, "clp", "right hand side after assignment");
     532      OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[2],4.0), {}, "clp", "right hand side after assignment");
     533      OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[3],5.0), {}, "clp", "right hand side after assignment");
     534      OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[4],15.), {}, "clp", "right hand side after assignment");
     535      OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[5],0.0), {}, "clp", "right hand side after assignment");
     536     
     537      const double *lhsrr = lhs.getRowRange();
     538      OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[0],0.0), {}, "clp", "row range after assignment");
     539      OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[1],0.0), {}, "clp", "row range after assignment");
     540      OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[2],0.0), {}, "clp", "row range after assignment");
     541      OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[3],5.0-1.8), {}, "clp", "row range after assignment");
     542      OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[4],15.0-3.0), {}, "clp", "row range after assignment");
     543      OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[5],0.0), {}, "clp", "row range after assignment");
    794544     
    795545      const CoinPackedMatrix * lhsmbr = lhs.getMatrixByRow();
    796       assert( lhsmbr != NULL );       
     546      OSIUNITTEST_ASSERT_ERROR(lhsmbr != NULL, {}, "clp", "matrix by row after assignment");
     547      OSIUNITTEST_ASSERT_ERROR(lhsmbr->getMajorDim()    ==  6, return 1, "clp", "matrix by row after assignment: major dim");
     548      OSIUNITTEST_ASSERT_ERROR(lhsmbr->getNumElements() == 14, return 1, "clp", "matrix by row after assignment: num elements");
     549
    797550      const double * ev = lhsmbr->getElements();
    798       assert( eq(ev[0],   3.0) );
    799       assert( eq(ev[1],   1.0) );
    800       assert( eq(ev[2],  -2.0) );
    801       assert( eq(ev[3],  -1.0) );
    802       assert( eq(ev[4],  -1.0) );
    803       assert( eq(ev[5],   2.0) );
    804       assert( eq(ev[6],   1.1) );
    805       assert( eq(ev[7],   1.0) );
    806       assert( eq(ev[8],   1.0) );
    807       assert( eq(ev[9],   2.8) );
    808       assert( eq(ev[10], -1.2) );
    809       assert( eq(ev[11],  5.6) );
    810       assert( eq(ev[12],  1.0) );
    811       assert( eq(ev[13],  1.9) );
     551      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "clp", "matrix by row after assignment: elements");
     552      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 1.0), {}, "clp", "matrix by row after assignment: elements");
     553      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2],-2.0), {}, "clp", "matrix by row after assignment: elements");
     554      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3],-1.0), {}, "clp", "matrix by row after assignment: elements");
     555      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4],-1.0), {}, "clp", "matrix by row after assignment: elements");
     556      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 2.0), {}, "clp", "matrix by row after assignment: elements");
     557      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6], 1.1), {}, "clp", "matrix by row after assignment: elements");
     558      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 1.0), {}, "clp", "matrix by row after assignment: elements");
     559      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8], 1.0), {}, "clp", "matrix by row after assignment: elements");
     560      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 2.8), {}, "clp", "matrix by row after assignment: elements");
     561      OSIUNITTEST_ASSERT_ERROR(eq(ev[10],-1.2), {}, "clp", "matrix by row after assignment: elements");
     562      OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "clp", "matrix by row after assignment: elements");
     563      OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "clp", "matrix by row after assignment: elements");
     564      OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "clp", "matrix by row after assignment: elements");
    812565     
    813566      const CoinBigIndex * mi = lhsmbr->getVectorStarts();
    814       assert( mi[0]==0 );
    815       assert( mi[1]==5 );
    816       assert( mi[2]==7 );
    817       assert( mi[3]==9 );
    818       assert( mi[4]==11 );
    819       assert( mi[5]==14 );
     567      OSIUNITTEST_ASSERT_ERROR(mi[0] ==  0, {}, "clp", "matrix by row after assignment: vector starts");
     568      OSIUNITTEST_ASSERT_ERROR(mi[1] ==  5, {}, "clp", "matrix by row after assignment: vector starts");
     569      OSIUNITTEST_ASSERT_ERROR(mi[2] ==  7, {}, "clp", "matrix by row after assignment: vector starts");
     570      OSIUNITTEST_ASSERT_ERROR(mi[3] ==  9, {}, "clp", "matrix by row after assignment: vector starts");
     571      OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "clp", "matrix by row after assignment: vector starts");
     572      OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "clp", "matrix by row after assignment: vector starts");
    820573     
    821574      const int * ei = lhsmbr->getIndices();
    822       assert( ei[0]  ==  0 );
    823       assert( ei[1]  ==  1 );
    824       assert( ei[2]  ==  3 );
    825       assert( ei[3]  ==  4 );
    826       assert( ei[4]  ==  7 );
    827       assert( ei[5]  ==  1 );
    828       assert( ei[6]  ==  2 );
    829       assert( ei[7]  ==  2 );
    830       assert( ei[8]  ==  5 );
    831       assert( ei[9]  ==  3 );
    832       assert( ei[10] ==  6 );
    833       assert( ei[11] ==  0 );
    834       assert( ei[12] ==  4 );
    835       assert( ei[13] ==  7 );   
    836      
    837       int md = lhsmbr->getMajorDim();
    838       assert(  md == 6 );
    839       assert( lhsmbr->getNumElements() == 14 );
    840     }
    841    
     575      OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "clp", "matrix by row after assignment: indices");
     576      OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "clp", "matrix by row after assignment: indices");
     577      OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "clp", "matrix by row after assignment: indices");
     578      OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "clp", "matrix by row after assignment: indices");
     579      OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "clp", "matrix by row after assignment: indices");
     580      OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "clp", "matrix by row after assignment: indices");
     581      OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "clp", "matrix by row after assignment: indices");
     582      OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "clp", "matrix by row after assignment: indices");
     583      OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "clp", "matrix by row after assignment: indices");
     584      OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "clp", "matrix by row after assignment: indices");
     585      OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "clp", "matrix by row after assignment: indices");
     586      OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "clp", "matrix by row after assignment: indices");
     587      OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "clp", "matrix by row after assignment: indices");
     588      OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "clp", "matrix by row after assignment: indices");
     589    }
    842590  }
    843591
     
    856604    double objValue = m.getObjValue();
    857605    CoinRelFltEq eq(1.0e-2);
    858     assert( eq(objValue,2520.57) );
     606    OSIUNITTEST_ASSERT_ERROR(eq(objValue,2520.57), {}, "clp", "objvalue after adding col");
     607
    859608    // Try deleting first column
    860609    int * d = new int[1];
     
    865614    m.resolve();
    866615    objValue = m.getObjValue();
    867     assert( eq(objValue,2520.57) );
     616    OSIUNITTEST_ASSERT_ERROR(eq(objValue,2520.57), {}, "clp", "objvalue after deleting first col");
     617
    868618    // Try deleting column we added
    869619    int iCol = m.getNumCols()-1;
     
    871621    m.resolve();
    872622    objValue = m.getObjValue();
    873     assert( eq(objValue,2520.57) );
    874 
     623    OSIUNITTEST_ASSERT_ERROR(eq(objValue,2520.57), {}, "clp", "objvalue after deleting added col");
    875624  }
     625
    876626  // Test branch and bound
    877627  {   
     
    906656    double objValue = m.getObjValue();
    907657    CoinRelFltEq eq(1.0e-2);
    908     assert( eq(objValue,-3089) );
     658    OSIUNITTEST_ASSERT_ERROR(eq(objValue,-3089), {}, "clp", "branch and bound");
    909659    const double * cs = m.getColSolution();
    910     for ( i=0;i<n;i++) {
    911       if (cs[i]>1.0e-7)
    912         printf("%d has value %g\n",i,cs[i]);
     660    if( OsiUnitTest::verbosity >= 2 )
     661      for ( i=0;i<n;i++) {
     662        if (cs[i]>1.0e-7)
     663          printf("%d has value %g\n",i,cs[i]);
    913664    }
    914665  }
    915   // Test matt
    916   if (fopen("../Mps/Infeas/galenet.mps","r")) {   
    917     OsiClpSolverInterface m;
    918     m.readMps("../Mps/Infeas/galenet","mps");
    919     m.setHintParam(OsiDoPresolveInResolve, true, OsiHintDo);
    920     m.resolve();
    921    
    922     std::vector<double *> rays = m.getDualRays(1);
    923     std::cout << "Dual Ray: " << std::endl;
    924     for(int i = 0; i < m.getNumRows(); i++){
    925       if(fabs(rays[0][i]) > 0.00001)
    926         std::cout << i << " : " << rays[0][i] << std::endl;
    927     }
    928    
    929     std::cout << "isProvenOptimal = " << m.isProvenOptimal() << std::endl;
    930     std::cout << "isProvenPrimalInfeasible = " << m.isProvenPrimalInfeasible()
    931          << std::endl;
    932    
    933     delete [] rays[0];
    934    
    935   }
     666
    936667  // Test infeasible bounds
    937668  {
     
    944675    solver.setHintParam(OsiDoPresolveInInitial, false, OsiHintDo);
    945676    solver.initialSolve();
    946     assert (!solver.isProvenOptimal());
     677    OSIUNITTEST_ASSERT_ERROR(!solver.isProvenOptimal(), {}, "clp", "infeasible bounds");
    947678  }
    948679
     
    1006737    model2.writeMps("integer");
    1007738    // check names are there
    1008     for (iColumn=0;iColumn<numberColumns;iColumn++) {
    1009       printf("%d name %s\n",iColumn,model2.getColName(iColumn).c_str());
    1010     }
     739    if (OsiUnitTest::verbosity >= 1)
     740      for (iColumn=0;iColumn<numberColumns;iColumn++)
     741        printf("%d name %s\n",iColumn,model2.getColName(iColumn).c_str());
    1011742   
    1012743    // Now do with strings attached
     
    1064795    if (numberColumns<50)
    1065796      build.setLogLevel(1);
    1066     int numberErrors=model2.loadFromCoinModel(build);
    1067797    // should fail as we never set multiplier
    1068     assert (numberErrors);
     798    OSIUNITTEST_ASSERT_ERROR(model2.loadFromCoinModel(build) != 0, {}, "clp", "build model with missing multipliers");
    1069799    build.associateElement("multiplier",0.0);
    1070     numberErrors=model2.loadFromCoinModel(build);
    1071     assert (!numberErrors);
     800    OSIUNITTEST_ASSERT_ERROR(model2.loadFromCoinModel(build) == 0, {}, "clp", "build model");
    1072801    model2.initialSolve();
    1073802    // It then loops with multiplier going from 0.0 to 2.0 in increments of 0.1
    1074803    for (double multiplier=0.0;multiplier<2.0;multiplier+= 0.1) {
    1075804      build.associateElement("multiplier",multiplier);
    1076       numberErrors=model2.loadFromCoinModel(build,true);
    1077       assert (!numberErrors);
     805      OSIUNITTEST_ASSERT_ERROR(model2.loadFromCoinModel(build,true) == 0, {}, "clp", "build model with increasing multiplier");
    1078806      model2.resolve();
    1079807    }
    1080808  }
     809
    1081810  // Solve an lp by hand
    1082811  {   
     
    1148877      int outStatus;
    1149878      double theta;
    1150       int returnCode=m.primalPivotResult(colIn,direction,
    1151                                          colOut,outStatus,theta,NULL);
    1152       assert (!returnCode);
    1153       printf("out %d, direction %d theta %g\n",
    1154              colOut,outStatus,theta);
     879      OSIUNITTEST_ASSERT_ERROR(m.primalPivotResult(colIn,direction,colOut,outStatus,theta,NULL) == 0, {}, "clp", "solve model by hand");
     880      if (OsiUnitTest::verbosity >= 1)
     881        printf("out %d, direction %d theta %g\n", colOut,outStatus,theta);
    1155882      if (colIn!=colOut) {
    1156         returnCode=mm->pivot(colIn,colOut,outStatus);
    1157         assert (returnCode>=0);
     883        OSIUNITTEST_ASSERT_ERROR(mm->pivot(colIn,colOut,outStatus) >= 0, {}, "clp", "solve model by hand");
    1158884      } else {
    1159885        // bound flip (so pivot does not make sense)
    1160         returnCode=mm->primalPivotResult(colIn,direction,
    1161                                          colOut,outStatus,theta,NULL);
    1162         assert (!returnCode);
     886        OSIUNITTEST_ASSERT_ERROR(mm->primalPivotResult(colIn,direction,colOut,outStatus,theta,NULL) == 0, {}, "clp", "solve model by hand");
    1163887      }
    1164888      numberIterations++;
     
    1173897    m.messageHandler()->setLogLevel(0);
    1174898    m.resolve();
    1175     assert (!m.getIterationCount());
     899    OSIUNITTEST_ASSERT_ERROR(m.getIterationCount() == 0, {}, "clp", "resolve after solving model by hand");
    1176900    m.setObjSense(-1.0);
    1177901    m.initialSolve();
    1178902  }
     903
    1179904# if 0
    1180905/*
     
    13131038  }
    13141039# endif
     1040
    13151041  // Solve an lp when interface is on
    13161042  {   
     
    13271053    m.initialSolve();
    13281054  }
     1055
    13291056  // Check tableau stuff when simplex interface is on
    13301057  {   
     
    13631090    double * binvA = (double*) malloc((n_cols+n_rows) * sizeof(double));
    13641091   
    1365     printf("B-1 A");
     1092    if (OsiUnitTest::verbosity >= 2)
     1093      printf("B-1 A");
    13661094    int i;
    13671095    for( i = 0; i < n_rows; i++){
    13681096      m.getBInvARow(i, binvA,binvA+n_cols);
    1369       printf("\nrow: %d -> ",i);
    1370       for(int j=0; j < n_cols+n_rows; j++){
    1371         printf("%g, ", binvA[j]);
    1372       }
    1373     }
    1374     printf("\n");
    1375     printf("And by column");
     1097      if (OsiUnitTest::verbosity >= 2) {
     1098        printf("\nrow: %d -> ",i);
     1099        for(int j=0; j < n_cols+n_rows; j++)
     1100          printf("%g, ", binvA[j]);
     1101      }
     1102    }
     1103    if (OsiUnitTest::verbosity >= 2) {
     1104      printf("\n");
     1105      printf("And by column");
     1106    }
    13761107    for( i = 0; i < n_cols+n_rows; i++){
    13771108      m.getBInvACol(i, binvA);
    1378       printf("\ncolumn: %d -> ",i);
    1379       for(int j=0; j < n_rows; j++){
    1380         printf("%g, ", binvA[j]);
    1381       }
    1382     }
    1383     printf("\n");
     1109      if (OsiUnitTest::verbosity >= 2) {
     1110        printf("\ncolumn: %d -> ",i);
     1111        for(int j=0; j < n_rows; j++)
     1112          printf("%g, ", binvA[j]);
     1113      }
     1114    }
     1115    if (OsiUnitTest::verbosity >= 2)
     1116      printf("\n");
     1117
    13841118    // and when doing as expert
    13851119    m.setSpecialOptions(m.specialOptions()|512);
     
    14061140      int * which;
    14071141      double * array;
    1408       printf("B-1 A");
     1142      if (OsiUnitTest::verbosity >= 2)
     1143        printf("B-1 A");
    14091144      for( i = 0; i < n_rows; i++){
    14101145        m.getBInvARow(i, binvA,binvA+n_cols);
    1411         printf("\nrow: %d -> ",i);
     1146        if (OsiUnitTest::verbosity >= 2)
     1147          printf("\nrow: %d -> ",i);
    14121148        int j;
    14131149        // First columns
     
    14171153        for(j=0; j < n; j++){
    14181154          int k=which[j];
    1419           if (!columnScale) {
    1420             printf("(%d %g), ", k, array[k]);
    1421           } else {
    1422             printf("(%d %g), ", k, array[k]/columnScale[k]);
     1155          if (OsiUnitTest::verbosity >= 2) {
     1156            if (!columnScale) {
     1157              printf("(%d %g), ", k, array[k]);
     1158            } else {
     1159              printf("(%d %g), ", k, array[k]/columnScale[k]);
     1160            }
    14231161          }
    14241162          // zero out
     
    14351173        for(j=0; j < n; j++){
    14361174          int k=which[j];
    1437           if (!rowScale) {
    1438             printf("(%d %g), ", k+n_cols, array[k]);
    1439           } else {
    1440             printf("(%d %g), ", k+n_cols, array[k]*rowScale[k]);
    1441           }
    1442           // zero out
    1443           array[k]=0.0;
    1444         }
    1445         // say empty
    1446         rowArray->setNumElements(0);
    1447         // and check (would not be in any production code)
    1448         rowArray->checkClear();
    1449       }
    1450       printf("\n");
    1451       printf("And by column (trickier)");
    1452       const int * pivotVariable = clp->pivotVariable();
    1453       for( i = 0; i < n_cols+n_rows; i++){
    1454         m.getBInvACol(i, binvA);
    1455         printf("\ncolumn: %d -> ",i);
    1456         n = rowArray->getNumElements();
    1457         which = rowArray->getIndices();
    1458         array = rowArray->denseVector();
    1459         for(int j=0; j < n; j++){
    1460           int k=which[j];
    1461           // need to know pivot variable for +1/-1 (slack) and row/column scaling
    1462           int pivot = pivotVariable[k];
    1463           if (pivot<n_cols) {
    1464             // scaled coding is in just in case
    1465             if (!columnScale) {
    1466               printf("(%d %g), ", k, array[k]);
     1175          if (OsiUnitTest::verbosity >= 2) {
     1176            if (!rowScale) {
     1177              printf("(%d %g), ", k+n_cols, array[k]);
    14671178            } else {
    1468               printf("(%d %g), ", k, array[k]*columnScale[pivot]);
    1469             }
    1470           } else {
    1471             if (!rowScale) {
    1472               printf("(%d %g), ", k, -array[k]);
    1473             } else {
    1474               printf("(%d %g), ", k, -array[k]/rowScale[pivot-n_cols]);
     1179              printf("(%d %g), ", k+n_cols, array[k]*rowScale[k]);
    14751180            }
    14761181          }
     
    14831188        rowArray->checkClear();
    14841189      }
    1485       printf("\n");
     1190      if (OsiUnitTest::verbosity >= 2) {
     1191        printf("\n");
     1192        printf("And by column (trickier)");
     1193      }
     1194      const int * pivotVariable = clp->pivotVariable();
     1195      for( i = 0; i < n_cols+n_rows; i++){
     1196        m.getBInvACol(i, binvA);
     1197        if (OsiUnitTest::verbosity >= 2)
     1198          printf("\ncolumn: %d -> ",i);
     1199        n = rowArray->getNumElements();
     1200        which = rowArray->getIndices();
     1201        array = rowArray->denseVector();
     1202        for(int j=0; j < n; j++){
     1203          int k=which[j];
     1204          // need to know pivot variable for +1/-1 (slack) and row/column scaling
     1205          int pivot = pivotVariable[k];
     1206          if (OsiUnitTest::verbosity >= 2) {
     1207            if (pivot<n_cols) {
     1208              // scaled coding is in just in case
     1209              if (!columnScale) {
     1210                printf("(%d %g), ", k, array[k]);
     1211              } else {
     1212                printf("(%d %g), ", k, array[k]*columnScale[pivot]);
     1213              }
     1214            } else {
     1215              if (!rowScale) {
     1216                printf("(%d %g), ", k, -array[k]);
     1217              } else {
     1218                printf("(%d %g), ", k, -array[k]/rowScale[pivot-n_cols]);
     1219              }
     1220            }
     1221          }
     1222          // zero out
     1223          array[k]=0.0;
     1224        }
     1225        // say empty
     1226        rowArray->setNumElements(0);
     1227        // and check (would not be in any production code)
     1228        rowArray->checkClear();
     1229      }
     1230      if (OsiUnitTest::verbosity >= 2)
     1231        printf("\n");
    14861232      // now deal with next pass
    14871233      if (!iPass) {
     
    15051251      int * which;
    15061252      double * array;
    1507       printf("B-1 A");
     1253      if (OsiUnitTest::verbosity >= 2)
     1254        printf("B-1 A");
    15081255      for( i = 0; i < n_rows; i++){
    15091256        m.getBInvARow(i, columnArray,rowArray);
    1510         printf("\nrow: %d -> ",i);
     1257        if (OsiUnitTest::verbosity >= 2)
     1258          printf("\nrow: %d -> ",i);
    15111259        int j;
    15121260        // First columns
     
    15161264        for(j=0; j < n; j++){
    15171265          int k=which[j];
    1518           printf("(%d %g), ", k, array[k]);
     1266          if (OsiUnitTest::verbosity >= 2)
     1267            printf("(%d %g), ", k, array[k]);
    15191268          // zero out
    15201269          array[k]=0.0;
     
    15301279        for(j=0; j < n; j++){
    15311280          int k=which[j];
    1532           printf("(%d %g), ", k+n_cols, array[k]);
     1281          if (OsiUnitTest::verbosity >= 2)
     1282            printf("(%d %g), ", k+n_cols, array[k]);
    15331283          // zero out
    15341284          array[k]=0.0;
     
    15391289        rowArray->checkClear();
    15401290      }
    1541       printf("\n");
    1542       printf("And by column");
    1543       const int * pivotVariable = clp->pivotVariable();
     1291      if (OsiUnitTest::verbosity >= 2) {
     1292        printf("\n");
     1293        printf("And by column");
     1294      }
    15441295      for( i = 0; i < n_cols+n_rows; i++){
    15451296        m.getBInvACol(i, rowArray);
    1546         printf("\ncolumn: %d -> ",i);
     1297        if (OsiUnitTest::verbosity >= 2)
     1298          printf("\ncolumn: %d -> ",i);
    15471299        n = rowArray->getNumElements();
    15481300        which = rowArray->getIndices();
     
    15501302        for(int j=0; j < n; j++){
    15511303          int k=which[j];
    1552           printf("(%d %g), ", k, array[k]);
     1304          if (OsiUnitTest::verbosity >= 2)
     1305            printf("(%d %g), ", k, array[k]);
    15531306          // zero out
    15541307          array[k]=0.0;
     
    15591312        rowArray->checkClear();
    15601313      }
    1561       printf("\n");
     1314      if (OsiUnitTest::verbosity >= 2)
     1315        printf("\n");
    15621316      delete rowArray;
    15631317      delete columnArray;
     
    15661320    m.disableFactorization();
    15671321  }
     1322
    15681323  // Check tableau stuff when simplex interface is off
    15691324  {   
     
    16101365    m.getBasics(pivots);
    16111366   
    1612     printf("B-1 A");
     1367    if (OsiUnitTest::verbosity >= 2)
     1368      printf("B-1 A");
    16131369    int i;
    16141370    for( i = 0; i < n_rows; i++){
    16151371      m.getBInvARow(i, binvA,binvA+n_cols);
    1616       printf("\nrow: %d (pivot %d) -> ",i,pivots[i]);
    1617       for(int j=0; j < n_cols+n_rows; j++){
    1618         printf("%g, ", binvA[j]);
    1619       }
    1620     }
    1621     printf("\n");
    1622     printf("And by column");
     1372      if (OsiUnitTest::verbosity >= 2) {
     1373        printf("\nrow: %d (pivot %d) -> ",i,pivots[i]);
     1374        for(int j=0; j < n_cols+n_rows; j++)
     1375          printf("%g, ", binvA[j]);
     1376      }
     1377    }
     1378    if (OsiUnitTest::verbosity >= 2) {
     1379      printf("\n");
     1380      printf("And by column");
     1381    }
    16231382    for( i = 0; i < n_cols+n_rows; i++){
    16241383      m.getBInvACol(i, binvA);
    1625       printf("\ncolumn: %d -> ",i);
    1626       for(int j=0; j < n_rows; j++){
    1627         printf("%g, ", binvA[j]);
    1628       }
    1629     }
    1630     printf("\n");
     1384      if (OsiUnitTest::verbosity >= 2) {
     1385        printf("\ncolumn: %d -> ",i);
     1386        for(int j=0; j < n_rows; j++)
     1387          printf("%g, ", binvA[j]);
     1388      }
     1389    }
     1390    if (OsiUnitTest::verbosity >= 2)
     1391      printf("\n");
    16311392    free(binvA);
    16321393    delete [] pivots;
    16331394  }
     1395
    16341396  // Do common solverInterface testing
    16351397  {
    16361398    OsiClpSolverInterface m;
    1637     return OsiSolverInterfaceCommonUnitTest(&m, mpsDir,netlibDir);
     1399    return OsiSolverInterfaceCommonUnitTest(&m, mpsDir, netlibDir);
    16381400  }
    16391401}
  • trunk/Clp/test/osiUnitTest.cpp

    r1709 r1740  
    55
    66#include "CoinPragma.hpp"
    7 
    87#include "OsiConfig.h"
    98
    10 #ifdef NDEBUG
    11 #undef NDEBUG
    12 #endif
    13 
    14 #include <cassert>
    159#include <cstdio>
    1610#include <iostream>
    17 #include <map>
    1811
    1912#include "OsiUnitTests.hpp"
     
    2619#include "OsiClpSolverInterface.hpp"
    2720
    28 namespace {
    29 
    30 // Display message on stdout and stderr. Flush cout buffer before printing the
    31 // message, so that output comes out in order in spite of buffered cout.
    32 
    33 void testingMessage( const char * const msg )
    34 {
    35   std::cout.flush() ;
    36   std::cerr <<msg;
    37   //cout <<endl <<"*****************************************"
    38   //     <<endl <<msg <<endl;
    39 }
    40 
    41 
    42 /*
    43   Utility routine to process command line parameters. An unrecognised parameter
    44   will trigger the help message and a return value of false.
    45  
    46   This should be replaced with the one of the standard CoinUtils parameter
    47   mechanisms.
    48 */
    49 bool processParameters (int argc, const char **argv,
    50                         std::map<std::string,std::string> &parms)
    51 
    52 {
    53   assert(argc >= 1);
    54   assert(argv != NULL);
    55 /*
    56   Initialise the parameter keywords.
    57 */
    58   std::set<std::string> definedKeyWords;
    59   definedKeyWords.insert("-cerr2cout");
    60   definedKeyWords.insert("-mpsDir");
    61   definedKeyWords.insert("-netlibDir");
    62   definedKeyWords.insert("-testOsiSolverInterface");
    63   definedKeyWords.insert("-nobuf");
    64 /*
    65   Set default values for data directories.
    66 */
    67   const char dirsep =  CoinFindDirSeparator() ;
    68   std::string pathTmp ;
    69 
    70   pathTmp = ".." ;
    71   pathTmp += dirsep ;
    72   pathTmp += ".." ;
    73   pathTmp += dirsep ;
    74   pathTmp += "Data" ;
    75   pathTmp += dirsep ;
    76 # ifdef COIN_MSVS
    77   // Visual Studio build is deeper
    78   pathTmp = "..\\..\\" + pathTmp ;
    79 # endif
    80 
    81   parms["-mpsDir"] = pathTmp + "Sample"  ;
    82   parms["-netlibDir"] = pathTmp + "Netlib" ;
    83 
    84 /*
    85   Read the command line parameters and fill a map of parameter keys and
    86   associated data. The parser allows for parameters which are only a keyword,
    87   or parameters of the form keyword=value (no spaces).
    88 */
    89   for (int i = 1 ; i < argc ; i++)
    90   { std::string parm(argv[i]) ;
    91     std::string key,value ;
    92     std::string::size_type eqPos = parm.find('=');
    93 
    94     if (eqPos == std::string::npos)
    95     { key = parm ; }
    96     else
    97     { key = parm.substr(0,eqPos) ;
    98       value = parm.substr(eqPos+1) ; }
    99 /*
    100   Is the specifed key valid?
    101 */
    102     if (definedKeyWords.find(key) == definedKeyWords.end())
    103     { std::cerr << "Undefined parameter \"" << key << "\"." << std::endl ;
    104       std::cerr
    105         << "Usage: " << argv[0]
    106         << " [-nobuf] [-mpsDir=V1] [-netlibDir=V2] "
    107         << "[-testOsiSolverInterface] " << std::endl ;
    108       std::cerr << "  where:" << std::endl ;
    109       std::cerr
    110         << "    "
    111         << "-cerr2cout: redirect cerr to cout; sometimes useful." << std::endl
    112         << "\t" << "to synchronise cout & cerr." << std::endl ;
    113       std::cerr
    114         << "    "
    115         << "-mpsDir: directory containing mps test files." << std::endl
    116         << "\t" << "Default value V1=\"../../Data/Sample\"" << std::endl ;
    117       std::cerr
    118         << "    "
    119         << "-netlibDir: directory containing netlib files." << std::endl
    120         << "\t" << "Default value V2=\"../../Data/Netlib\"" << std::endl ;
    121       std::cerr
    122         << "    "
    123         << "-testOsiSolverInterface: "
    124         << "run each OSI on the netlib problem set." << std::endl
    125         << "\t"
    126         << "Default is to not run the netlib problem set." << std::endl ;
    127       std::cerr
    128         << "    "
    129         << "-nobuf: use unbuffered output." << std::endl
    130         << "\t" << "Default is buffered output." << std::endl ;
    131      
    132       return (false) ; }
    133 /*
    134   Valid keyword; stash the value for later reference.
    135 */
    136     parms[key]=value ; }
    137 /*
    138   Tack the directory separator onto the data directories so we don't have to
    139   worry about it later.
    140 */
    141   parms["-mpsDir"] += dirsep ;
    142   parms["-netlibDir"] += dirsep ;
    143 /*
    144   Did the user request unbuffered i/o? It seems we need to go after this
    145   through stdio --- using pubsetbuf(0,0) on the C++ streams has no
    146   discernible affect. Nor, for that matter, did setting the unitbuf flag on
    147   the streams. Why? At a guess, sync_with_stdio connects the streams to the
    148   stdio buffers, and the C++ side isn't programmed to change them?
    149 */
    150   if (parms.find("-nobuf") != parms.end())
    151   { // std::streambuf *coutBuf, *cerrBuf ;
    152     // coutBuf = std::cout.rdbuf() ;
    153     // coutBuf->pubsetbuf(0,0) ;
    154     // cerrBuf = std::cerr.rdbuf() ;
    155     // cerrBuf->pubsetbuf(0,0) ;
    156     setbuf(stderr,0) ;
    157     setbuf(stdout,0) ; }
    158 /*
    159   Did the user request a redirect for cerr? This must occur before any i/o is
    160   performed.
    161 */
    162   if (parms.find("-cerr2cout") != parms.end())
    163   { std::cerr.rdbuf(std::cout.rdbuf()) ; }
    164 
    165   return (true) ; }
    166 
    167 
    168 }       // end file-local namespace
    169 
    170 
     21using namespace OsiUnitTest;
    17122
    17223//----------------------------------------------------------------
    17324// unitTest [-nobuf] [-mpsDir=V1] [-netlibDir=V2] [-testOsiSolverInterface]
     25//      [-cutsOnly]
    17426//
    17527// where:
    17628//   -nobuf: remove buffering on cout (stdout); useful to keep cout and cerr
    177 //      messages synchronised when redirecting output to a file or pipe.
     29//  messages synchronised when redirecting output to a file or pipe.
    17830//   -mpsDir: directory containing mps test files
    17931//       Default value V1="../../Data/Sample"   
     
    18335//       If specified, then OsiSolveInterface::unitTest
    18436//       is skipped over and not run.
     37//   -cutsOnly
     38//   If specified, only OsiCut tests are run.
    18539//
    18640// All parameters are optional.
     
    18842
    18943int main (int argc, const char *argv[])
    190 
    191 { int totalErrCnt = 0;
     44{
     45  bool exception = false;
     46  outcomes.clear();
    19247
    19348/*
     
    20964  Process command line parameters.
    21065*/
    211   std::map<std::string,std::string> parms ;
    212 
     66  std::map<std::string,std::string> parms;
    21367  if (processParameters(argc,argv,parms) == false)
    21468  { return (1) ; }
     
    21771  std::string netlibDir = parms["-netlibDir"] ;
    21872
    219 try {
    220 /*
    221   Test Osi{Row,Col}Cut routines.
    222 */
    223   {
    224     OsiClpSolverInterface clpSi;
    225     testingMessage( "Testing OsiRowCut with OsiClpSolverInterface\n" );
    226     OsiRowCutUnitTest(&clpSi,mpsDir);
    227   }
    228   {
    229     OsiClpSolverInterface clpSi;
    230     testingMessage( "Testing OsiColCut with OsiClpSolverInterface\n" );
    231     OsiColCutUnitTest(&clpSi,mpsDir);
    232   }
    233   {
    234     OsiClpSolverInterface clpSi;
    235     testingMessage( "Testing OsiRowCutDebugger with OsiClpSolverInterface\n" );
    236     OsiRowCutDebuggerUnitTest(&clpSi,mpsDir);
     73  try {
     74    /*
     75      Test Osi{Row,Col}Cut routines.
     76    */
     77    {
     78      OsiClpSolverInterface clpSi;
     79      testingMessage( "Testing OsiRowCut with OsiClpSolverInterface\n" );
     80      OsiRowCutUnitTest(&clpSi,mpsDir);
     81    }
     82    {
     83      OsiClpSolverInterface clpSi;
     84      testingMessage( "Testing OsiColCut with OsiClpSolverInterface\n" );
     85      OsiColCutUnitTest(&clpSi,mpsDir);
     86    }
     87    {
     88      OsiClpSolverInterface clpSi;
     89      testingMessage( "Testing OsiRowCutDebugger with OsiClpSolverInterface\n" );
     90      OsiRowCutDebuggerUnitTest(&clpSi,mpsDir);
     91    }
     92
     93    /*
     94      Run the OsiXXX class test. It's up to the OsiClp implementor
     95      to decide whether or not to run OsiSolverInterfaceCommonUnitTest. Arguably
     96      this should be required.
     97    */
     98    testingMessage( "Testing OsiClpSolverInterface\n" );
     99    OsiClpSolverInterfaceUnitTest(mpsDir,netlibDir);
     100
     101    /*
     102      We have run the specialised unit test. Check now to see if we need to
     103      run through the Netlib problems.
     104    */
     105    if (parms.find("-testOsiSolverInterface") != parms.end())
     106    {
     107      // Create vector of solver interfaces
     108      std::vector<OsiSolverInterface*> vecSi(1, new OsiClpSolverInterface);
     109
     110      testingMessage( "Testing OsiSolverInterface on Netlib problems.\n" );
     111      OsiSolverInterfaceMpsUnitTest(vecSi,netlibDir);
     112
     113      delete vecSi[0];
     114    }
     115    else {
     116      testingMessage( "***Skipped Testing of OsiClpSolverInterface on Netlib problems***\n" );
     117      testingMessage( "***use -testOsiSolverInterface to run them.***\n" );
     118    }
     119  } catch (CoinError& error) {
     120    std::cout.flush();
     121    std::cerr << "Caught CoinError exception: ";
     122    error.print(true);
     123    exception = true;
    237124  }
    238125
    239 /*
    240   Run the OsiXXX class test. It's up to the OsiClp implementor
    241   to decide whether or not to run OsiSolverInterfaceCommonUnitTest. Arguably
    242   this should be required.
    243 */
    244   testingMessage( "Testing OsiClpSolverInterface\n" );
    245   OsiClpSolverInterfaceUnitTest(mpsDir,netlibDir);
     126  /*
     127    We're done. Report on the results.
     128  */
     129  std::cout.flush();
     130  outcomes.print();
    246131
    247 /*
    248   We have run the specialised unit test. Check now to see if we need to
    249   run through the Netlib problems.
    250 */
    251   if (parms.find("-testOsiSolverInterface") != parms.end())
    252   {
    253     // Create vector of solver interfaces
    254     std::vector<OsiSolverInterface*> vecSi(1, new OsiClpSolverInterface);
     132  int nerrors;
     133  int nerrors_expected;
     134  outcomes.getCountBySeverity(TestOutcome::ERROR, nerrors, nerrors_expected);
    255135
    256     testingMessage( "Testing OsiSolverInterface on Netlib problems.\n" );
    257     OsiSolverInterfaceMpsUnitTest(vecSi,netlibDir);
     136  if (nerrors > nerrors_expected)
     137    std::cerr << "Tests completed with " << nerrors - nerrors_expected << " unexpected errors." << std::endl ;
     138  else
     139    std::cerr << "All tests completed successfully\n";
    258140
    259     delete vecSi[0];
    260   }
    261   else {
    262     testingMessage( "***Skipped Testing of OsiClpSolverInterface on Netlib problems***\n" );
    263     testingMessage( "***use -testOsiSolverInterface to run them.***\n" );
    264   }
    265 } catch (CoinError& error) {
    266   std::cout.flush();
    267   std::cerr << "Caught CoinError exception: ";
    268   error.print(true);
    269   totalErrCnt += 1;
     141  return (nerrors - nerrors_expected) + (exception ? 1 : 0);
    270142}
    271 /*
    272   We're done. Report on the results.
    273 */
    274   if (totalErrCnt)
    275   { std::cout.flush() ;
    276     std::cerr
    277       << "Tests completed with " << totalErrCnt << " errors." << std::endl ;
    278   } else
    279   { testingMessage("All tests completed successfully\n") ; }
    280   return totalErrCnt;
    281 }
Note: See TracChangeset for help on using the changeset viewer.