Dip
0.92.4
|
A namespace so we can define a few `global' variables to use during tests. More...
Classes | |
class | TestOutcome |
A single test outcome record. More... | |
class | TestOutcomes |
Utility class to maintain a list of test outcomes. More... | |
Functions | |
void | failureMessage (const std::string &solverName, const std::string &message) |
Print an error message. More... | |
void | failureMessage (const OsiSolverInterface &si, const std::string &message) |
void | failureMessage (const std::string &solverName, const std::string &testname, const std::string &testcond) |
Print an error message, specifying the test name and condition. More... | |
void | failureMessage (const OsiSolverInterface &si, const std::string &testname, const std::string &testcond) |
void | testingMessage (const char *const msg) |
Print a message. More... | |
bool | equivalentVectors (const OsiSolverInterface *si1, const OsiSolverInterface *si2, double tol, const double *v1, const double *v2, int size) |
Utility method to check equality. More... | |
bool | compareProblems (OsiSolverInterface *osi1, OsiSolverInterface *osi2) |
Compare two problems for equality. More... | |
bool | isEquivalent (const CoinPackedVectorBase &pv, int n, const double *fv) |
Compare a packed vector with an expanded vector. More... | |
bool | 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 >()) |
Process command line parameters. More... | |
template<typename Component > | |
bool | OsiUnitTestAssertSeverityExpected (bool condition, const char *condition_str, const char *filename, int line, const Component &component, const std::string &testname, TestOutcome::SeverityLevel severity, bool expected) |
Variables | |
unsigned int | verbosity |
Verbosity level of unit tests. More... | |
unsigned int | haltonerror |
Behaviour on failing a test. More... | |
TestOutcomes | outcomes |
Test outcomes. More... | |
A namespace so we can define a few `global' variables to use during tests.
void OsiUnitTest::failureMessage | ( | const std::string & | solverName, |
const std::string & | message | ||
) |
Print an error message.
Formatted as "XxxSolverInterface testing issue: message" where Xxx is the string provided as solverName
.
Flushes std::cout before printing to std::cerr.
Referenced by OsiUnitTestAssertSeverityExpected().
void OsiUnitTest::failureMessage | ( | const OsiSolverInterface & | si, |
const std::string & | message | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void OsiUnitTest::failureMessage | ( | const std::string & | solverName, |
const std::string & | testname, | ||
const std::string & | testcond | ||
) |
Print an error message, specifying the test name and condition.
Formatted as "XxxSolverInterface testing issue: testname failed: testcond" where Xxx is the OsiStrParam::OsiSolverName parameter of the si
. Flushes std::cout before printing to std::cerr.
void OsiUnitTest::failureMessage | ( | const OsiSolverInterface & | si, |
const std::string & | testname, | ||
const std::string & | testcond | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void OsiUnitTest::testingMessage | ( | const char *const | msg | ) |
Print a message.
Prints the message as given. Flushes std::cout before printing to std::cerr.
Referenced by OsiUnitTestAssertSeverityExpected().
bool OsiUnitTest::equivalentVectors | ( | const OsiSolverInterface * | si1, |
const OsiSolverInterface * | si2, | ||
double | tol, | ||
const double * | v1, | ||
const double * | v2, | ||
int | size | ||
) |
Utility method to check equality.
Tests for equality using CoinRelFltEq with tolerance tol
. Understands the notion of solver infinity and obtains the value for infinity from the solver interfaces supplied as parameters.
bool OsiUnitTest::compareProblems | ( | OsiSolverInterface * | osi1, |
OsiSolverInterface * | osi2 | ||
) |
Compare two problems for equality.
Compares the problems held in the two solvers: constraint matrix, row and column bounds, column type, and objective. Rows are checked using upper and lower bounds and using sense, bound, and range.
bool OsiUnitTest::isEquivalent | ( | const CoinPackedVectorBase & | pv, |
int | n, | ||
const double * | fv | ||
) |
Compare a packed vector with an expanded vector.
Checks that all values present in the packed vector are present in the full vector and checks that there are no extra entries in the full vector. Uses CoinRelFltEq with the default tolerance.
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 >() |
||
) |
Process command line parameters.
An unrecognised keyword which is not in the ignorekeywords
map will trigger the help message and a return value of false. For each keyword in ignorekeywords
, you can specify the number of following parameters that should be ignored.
This should be replaced with the one of the standard CoinUtils parameter mechanisms.
bool OsiUnitTest::OsiUnitTestAssertSeverityExpected | ( | bool | condition, |
const char * | condition_str, | ||
const char * | filename, | ||
int | line, | ||
const Component & | component, | ||
const std::string & | testname, | ||
TestOutcome::SeverityLevel | severity, | ||
bool | expected | ||
) |
Definition at line 239 of file OsiUnitTests.hpp.
References OsiUnitTest::TestOutcomes::add(), OsiUnitTest::TestOutcome::ERROR, failureMessage(), haltonerror, outcomes, OsiUnitTest::TestOutcome::PASSED, testingMessage(), and verbosity.
unsigned int OsiUnitTest::verbosity |
Verbosity level of unit tests.
0 (default) for minimal output; larger numbers produce more output
Referenced by OsiUnitTestAssertSeverityExpected().
unsigned int OsiUnitTest::haltonerror |
Behaviour on failing a test.
Referenced by OsiUnitTestAssertSeverityExpected().
TestOutcomes OsiUnitTest::outcomes |
Test outcomes.
A global TestOutcomes object to store test outcomes during the run of the unit test for an OSI.
Referenced by OsiUnitTestAssertSeverityExpected().