- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# /home/coin/SVN-release/Alps-1.3.0/Osi/src/OsiCommonTest/OsiUnitTests.hpp File Reference

`#include <string>`
`#include <sstream>`
`#include <vector>`
`#include <list>`
`#include <map>`

Include dependency graph for OsiUnitTests.hpp:

Go to the source code of this file.

## Namespaces
namespace | OsiUnitTest
## Classes
class | OsiUnitTest::TestOutcome
class | OsiUnitTest::TestOutcomes
## Defines
#define | OSIUNITTEST_QUOTEME_(x) #x
#define | OSIUNITTEST_QUOTEME(x) OSIUNITTEST_QUOTEME_(x)
#define | OSIUNITTEST_ADD_OUTCOME(component, testname, testcondition, severity, expected) OsiUnitTest::outcomes.add(component, testname, testcondition, severity, __FILE__, __LINE__, expected)
#define | OSIUNITTEST_ASSERT_SEVERITY_EXPECTED(condition, failurecode, component, testname, severity, expected)
#define | OSIUNITTEST_ASSERT_ERROR(condition, failurecode, component, testname) OSIUNITTEST_ASSERT_SEVERITY_EXPECTED(condition, failurecode, component, testname, OsiUnitTest::TestOutcome::ERROR, false)
#define | OSIUNITTEST_ASSERT_WARNING(condition, failurecode, component, testname) OSIUNITTEST_ASSERT_SEVERITY_EXPECTED(condition, failurecode, component, testname, OsiUnitTest::TestOutcome::WARNING, false)
#define | OSIUNITTEST_CATCH_SEVERITY_EXPECTED(trycode, catchcode, component, testname, severity, expected)
#define | OSIUNITTEST_CATCH_ERROR(trycode, catchcode, component, testname) OSIUNITTEST_CATCH_SEVERITY_EXPECTED(trycode, catchcode, component, testname, OsiUnitTest::TestOutcome::ERROR, false)
#define | OSIUNITTEST_CATCH_WARNING(trycode, catchcode, component, testname) OSIUNITTEST_CATCH_SEVERITY_EXPECTED(trycode, catchcode, component, testname, OsiUnitTest::TestOutcome::WARNING, false)
## Functions
void | OsiSolverInterfaceMpsUnitTest (const std::vector< OsiSolverInterface * > &vecEmptySiP, const std::string &mpsDir)
| A function that tests that a lot of problems given in MPS files (mostly the NETLIB problems) solve properly with all the specified solvers.
void | OsiSolverInterfaceCommonUnitTest (const OsiSolverInterface *emptySi, const std::string &mpsDir, const std::string &netlibDir)
| A function that tests the methods in the OsiSolverInterface class.
void | OsiColCutUnitTest (const OsiSolverInterface *baseSiP, const std::string &mpsDir)
| A function that tests the methods in the OsiColCut class.
void | OsiRowCutUnitTest (const OsiSolverInterface *baseSiP, const std::string &mpsDir)
| A function that tests the methods in the OsiRowCut class.
void | OsiRowCutDebuggerUnitTest (const OsiSolverInterface *siP, const std::string &mpsDir)
| A function that tests the methods in the OsiRowCutDebugger class.
void | OsiCutsUnitTest ()
| A function that tests the methods in the OsiCuts class.
void | OsiUnitTest::failureMessage (const std::string &solverName, const std::string &message)
void | OsiUnitTest::failureMessage (const OsiSolverInterface &si, const std::string &message)
void | OsiUnitTest::failureMessage (const std::string &solverName, const std::string &testname, const std::string &testcond)
void | OsiUnitTest::failureMessage (const OsiSolverInterface &si, const std::string &testname, const std::string &testcond)
void | OsiUnitTest::testingMessage (const char *const msg)
bool | OsiUnitTest::equivalentVectors (const OsiSolverInterface *si1, const OsiSolverInterface *si2, double tol, const double *v1, const double *v2, int size)
bool | OsiUnitTest::compareProblems (OsiSolverInterface *osi1, OsiSolverInterface *osi2)
bool | OsiUnitTest::isEquivalent (const CoinPackedVectorBase &pv, int n, const double *fv)
bool | OsiUnitTest::processParameters (int argc, const char **argv, std::map< std::string, std::string > &parms, const std::map< std::string, int > &ignorekeywords=std::map< std::string, int >())
| Utility routine to process Osi unittest command line parameters.
## Variables
unsigned int | OsiUnitTest::verbosity
| verbosity level of unit tests 0 (= default) for minimal output
unsigned int | OsiUnitTest::haltonerror
| behaviour on failing test 0 (= default) continue 1 press any key to continue 2 stop with abort()
TestOutcomes | OsiUnitTest::outcomes
| a global TestOutcomes object to store test outcomes during a run of the Osi unittest

## Define Documentation

#define OSIUNITTEST_QUOTEME_ | ( | x |  | ) | #x

Definition at line 153 of file OsiUnitTests.hpp.

#define OSIUNITTEST_QUOTEME | ( | x |  | ) | OSIUNITTEST_QUOTEME_(x)

Definition at line 154 of file OsiUnitTests.hpp.

#define OSIUNITTEST_ADD_OUTCOME | ( | component,
|  | testname,
|  | testcondition,
|  | severity,
|  | expected |  | ) | OsiUnitTest::outcomes.add(component, testname, testcondition, severity, __FILE__, __LINE__, expected)

Definition at line 156 of file OsiUnitTests.hpp.

#define OSIUNITTEST_ASSERT_SEVERITY_EXPECTED | ( | condition,
|  | failurecode,
|  | component,
|  | testname,
|  | severity,
|  | expected |  | ) |

Value:

    { \
                    if( condition ) { \
                            OSIUNITTEST_ADD_OUTCOME(component, testname, #condition, OsiUnitTest::TestOutcome::PASSED, false); \
                      if (OsiUnitTest::verbosity >= 2) { \
                            std::string successmsg(__FILE__ ":" OSIUNITTEST_QUOTEME(__LINE__) ": "); \
                              successmsg = successmsg + testname; \
                              successmsg = successmsg + " (condition \'" #condition "\') passed.\n"; \
                                    OsiUnitTest::testingMessage(successmsg.c_str()); \
                      } \
                    } else { \
                            OSIUNITTEST_ADD_OUTCOME(component, testname, #condition, severity, expected); \
                            OsiUnitTest::failureMessage(component, testname, #condition); \
          switch( OsiUnitTest::haltonerror ) { \
            case 2: if( severity >= OsiUnitTest::TestOutcome::ERROR ) abort(); break; \
            case 1: std::cout << std::endl << "press any key to continue..." << std::endl; getchar(); \
            default: ; } \
                            failurecode; \
        } \
            }

Definition at line 159 of file OsiUnitTests.hpp.

#define OSIUNITTEST_ASSERT_ERROR | ( | condition,
|  | failurecode,
|  | component,
|  | testname |  | ) | OSIUNITTEST_ASSERT_SEVERITY_EXPECTED(condition, failurecode, component, testname, OsiUnitTest::TestOutcome::ERROR, false)

Definition at line 180 of file OsiUnitTests.hpp.

#define OSIUNITTEST_ASSERT_WARNING | ( | condition,
|  | failurecode,
|  | component,
|  | testname |  | ) | OSIUNITTEST_ASSERT_SEVERITY_EXPECTED(condition, failurecode, component, testname, OsiUnitTest::TestOutcome::WARNING, false)

Definition at line 183 of file OsiUnitTests.hpp.

#define OSIUNITTEST_CATCH_SEVERITY_EXPECTED | ( | trycode,
|  | catchcode,
|  | component,
|  | testname,
|  | severity,
|  | expected |  | ) |

Definition at line 186 of file OsiUnitTests.hpp.

#define OSIUNITTEST_CATCH_ERROR | ( | trycode,
|  | catchcode,
|  | component,
|  | testname |  | ) | OSIUNITTEST_CATCH_SEVERITY_EXPECTED(trycode, catchcode, component, testname, OsiUnitTest::TestOutcome::ERROR, false)

Definition at line 223 of file OsiUnitTests.hpp.

#define OSIUNITTEST_CATCH_WARNING | ( | trycode,
|  | catchcode,
|  | component,
|  | testname |  | ) | OSIUNITTEST_CATCH_SEVERITY_EXPECTED(trycode, catchcode, component, testname, OsiUnitTest::TestOutcome::WARNING, false)

Definition at line 226 of file OsiUnitTests.hpp.

## Function Documentation

void OsiSolverInterfaceMpsUnitTest | ( | const std::vector< OsiSolverInterface * > & | vecEmptySiP,
|  | const std::string & | mpsDir |
| ) |  |  |

A function that tests that a lot of problems given in MPS files (mostly the NETLIB problems) solve properly with all the specified solvers.

The routine creates a vector of NetLib problems (problem name, objective, various other characteristics), and a vector of solvers to be tested.

Each solver is run on each problem. The run is deemed successful if the solver reports the correct problem size after loading and returns the correct objective value after optimization.

If multiple solvers are available, the results are compared pairwise against the results reported by adjacent solvers in the solver vector. Due to limitations of the volume solver, it must be the last solver in vecEmptySiP.

void OsiSolverInterfaceCommonUnitTest | ( | const OsiSolverInterface * | emptySi,
|  | const std::string & | mpsDir,
|  | const std::string & | netlibDir |
| ) |  |  |

A function that tests the methods in the OsiSolverInterface class.

Some time ago, if this method is compiled with optimization, the compilation took 10-15 minutes and the machine pages (has 256M core memory!)...

void OsiColCutUnitTest | ( | const OsiSolverInterface * | baseSiP,
|  | const std::string & | mpsDir |
| ) |  |  |

A function that tests the methods in the OsiColCut class.

void OsiRowCutUnitTest | ( | const OsiSolverInterface * | baseSiP,
|  | const std::string & | mpsDir |
| ) |  |  |

A function that tests the methods in the OsiRowCut class.

void OsiRowCutDebuggerUnitTest | ( | const OsiSolverInterface * | siP,
|  | const std::string & | mpsDir |
| ) |  |  |

A function that tests the methods in the OsiRowCutDebugger class.

void OsiCutsUnitTest | ( |  | ) |

A function that tests the methods in the OsiCuts class.