Changeset 1745
- Timestamp:
- Jun 13, 2011 11:09:00 AM (10 years ago)
- Location:
- trunk/Clp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Clp/src/OsiClp/OsiClpSolverInterface.hpp
r1739 r1745 38 38 class OsiClpSolverInterface : 39 39 virtual public OsiSolverInterface { 40 friend intOsiClpSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir);40 friend void OsiClpSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); 41 41 42 42 public: … … 1480 1480 bool OsiClpHasNDEBUG(); 1481 1481 //############################################################################# 1482 /** A function that tests the methods in the OsiClpSolverInterface class. The 1483 only reason for it not to be a member method is that this way it doesn't 1484 have to be compiled into the library. And that's a gain, because the 1485 library should be compiled with optimization on, but this method should be 1486 compiled with debugging. Also, if this method is compiled with 1487 optimization, the compilation takes 10-15 minutes and the machine pages 1488 (has 256M core memory!)... */ 1489 int 1490 OsiClpSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); 1482 /** A function that tests the methods in the OsiClpSolverInterface class. */ 1483 void OsiClpSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); 1491 1484 #endif -
trunk/Clp/test/OsiClpSolverInterfaceTest.cpp
r1740 r1745 5 5 6 6 #include "CoinPragma.hpp" 7 #include "OsiConfig.h"8 7 9 8 //#include <cassert> … … 13 12 14 13 #include "OsiClpSolverInterface.hpp" 14 #include "OsiUnitTests.hpp" 15 15 #include "OsiCuts.hpp" 16 16 #include "OsiRowCut.hpp" 17 17 #include "OsiColCut.hpp" 18 #include "OsiUnitTests.hpp"19 18 #include "CoinMessage.hpp" 20 19 #include "ClpMessage.hpp" … … 48 47 //-------------------------------------------------------------------------- 49 48 // test EKKsolution methods. 50 int 49 void 51 50 OsiClpSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir) 52 51 { 53 54 52 // Test default constructor 55 53 { … … 174 172 const double * rl = clpSi.getRowLower(); 175 173 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");174 OSIUNITTEST_ASSERT_ERROR(nc == 8, return, "clp", "read and copy exmip1"); 175 OSIUNITTEST_ASSERT_ERROR(nr == 5, return, "clp", "read and copy exmip1"); 178 176 OSIUNITTEST_ASSERT_ERROR(eq(cl[0],2.5), {}, "clp", "read and copy exmip1"); 179 177 OSIUNITTEST_ASSERT_ERROR(eq(cl[1],0.0), {}, "clp", "read and copy exmip1"); … … 215 213 const CoinPackedMatrix * smP = si.getMatrixByRow(); 216 214 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");215 OSIUNITTEST_ASSERT_ERROR(smP->getMajorDim() == 5, return, "clp", "getMatrixByRow: major dim"); 216 OSIUNITTEST_ASSERT_ERROR(smP->getNumElements() == 14, return, "clp", "getMatrixByRow: num elements"); 219 217 220 218 CoinRelFltEq eq; … … 338 336 // Test matrixByCol method 339 337 { 340 341 338 const OsiClpSolverInterface si(m); 342 339 const CoinPackedMatrix * smP = si.getMatrixByCol(); 343 340 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");341 OSIUNITTEST_ASSERT_ERROR(smP->getMajorDim() == 8, return, "clp", "getMatrixByCol: major dim"); 342 OSIUNITTEST_ASSERT_ERROR(smP->getMinorDim() == 5, return, "clp", "getMatrixByCol: minor dim"); 343 OSIUNITTEST_ASSERT_ERROR(smP->getNumElements() == 14, return, "clp", "getMatrixByCol: number of elements"); 344 OSIUNITTEST_ASSERT_ERROR(smP->getSizeVectorStarts() == 9, return, "clp", "getMatrixByCol: vector starts size"); 348 345 349 346 CoinRelFltEq eq; … … 426 423 const CoinPackedMatrix * siC1mbr = siC1.getMatrixByRow(); 427 424 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");425 OSIUNITTEST_ASSERT_ERROR(siC1mbr->getMajorDim() == 5, return, "clp", "matrix by row: major dim"); 426 OSIUNITTEST_ASSERT_ERROR(siC1mbr->getNumElements() == 14, return, "clp", "matrix by row: num elements"); 430 427 431 428 const double * ev = siC1mbr->getElements(); … … 545 542 const CoinPackedMatrix * lhsmbr = lhs.getMatrixByRow(); 546 543 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");544 OSIUNITTEST_ASSERT_ERROR(lhsmbr->getMajorDim() == 6, return, "clp", "matrix by row after assignment: major dim"); 545 OSIUNITTEST_ASSERT_ERROR(lhsmbr->getNumElements() == 14, return, "clp", "matrix by row after assignment: num elements"); 549 546 550 547 const double * ev = lhsmbr->getElements(); … … 1397 1394 { 1398 1395 OsiClpSolverInterface m; 1399 returnOsiSolverInterfaceCommonUnitTest(&m, mpsDir, netlibDir);1396 OsiSolverInterfaceCommonUnitTest(&m, mpsDir, netlibDir); 1400 1397 } 1401 1398 } -
trunk/Clp/test/osiUnitTest.cpp
r1744 r1745 5 5 6 6 #include "CoinPragma.hpp" 7 #include "OsiConfig.h"8 7 9 #include <cstdio>10 8 #include <iostream> 11 9 12 10 #include "OsiUnitTests.hpp" 13 #include "OsiRowCutDebugger.hpp"14 #include "OsiRowCut.hpp"15 #include "OsiColCut.hpp"16 17 #include "CoinError.hpp"18 19 11 #include "OsiClpSolverInterface.hpp" 20 12 … … 30 22 Start off with various bits of initialisation that don't really belong 31 23 anywhere else. 32 */ 33 outcomes.clear(); 34 /* 24 35 25 Synchronise C++ stream i/o with C stdio. This makes debugging 36 26 output a bit more comprehensible. It still suffers from interleave of cout
Note: See TracChangeset
for help on using the changeset viewer.