Skip to content

Commit

Permalink
Fix for unit test to not fail if it doesn't get the arguments for spe…
Browse files Browse the repository at this point in the history
…cifying directories, which it may not
  • Loading branch information
tkralphs committed Apr 10, 2020
1 parent 9acb3b2 commit ddcf710
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ matrix:
compiler: clang

before_script:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; brew install bash gcc; clang --version; gfortran --version; fi
- if [[ "$TRAVIS_OS_NAME $CC" == "osx gcc" ]]; then export CC=gcc-9 ; export CXX=g++-9 ; $CC --version; $CXX --version; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then if [ x`brew list | fgrep bash` != x'bash' ]; then brew install bash; fi; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then if [ x`brew list | fgrep gcc` != x'gcc' ]; then brew install gcc; fi; fi
- if [[ "$TRAVIS_OS_NAME $CC" == "osx gcc" ]]; then export CC=gcc-9 ; export CXX=g++-9 ; $CC --version; $CXX --version; gfortran --version; fi
- cd ..
- wget https://raw.githubusercontent.com/coin-or/coinbrew/master/coinbrew
- export PROJECT_URL=https://github.com/$TRAVIS_REPO_SLUG
Expand Down
29 changes: 17 additions & 12 deletions test/unitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ int main (int argc, const char *argv[])
/*
Set parameter defaults.
*/
std::string mpsDir = dataDir + dirsep + "Sample" + dirsep ;
std::string netlibDir = dataDir + dirsep + "Netlib" + dirsep ;
std::string testModel = "p0033.mps" ;
//TKR: Don't set defaults, must be specified.
std::string mpsDir = ""; // = dataDir + dirsep + "Sample" + dirsep ;
std::string netlibDir = ""; // = dataDir + dirsep + "Netlib" + dirsep ;
std::string testModel = ""; // = "p0033.mps" ;
/*
Process command line parameters. Assume params of the
form 'keyword' or 'keyword=value'.
Expand Down Expand Up @@ -172,12 +173,14 @@ int main (int argc, const char *argv[])
# endif


testingMessage( "Testing CoinModel\n" );
CoinModelUnitTest(mpsDir,netlibDir,testModel);

if (netlibDir != "" && mpsDir != "" && testModel != ""){
testingMessage( "Testing CoinModel\n" );
CoinModelUnitTest(mpsDir,netlibDir,testModel);
}

testingMessage( "Testing CoinError\n" );
CoinErrorUnitTest();

testingMessage( "Testing CoinShallowPackedVector\n" );
CoinShallowPackedVectorUnitTest();

Expand All @@ -198,12 +201,14 @@ int main (int argc, const char *argv[])
CoinDenseVectorUnitTest<float>(0.0f);
#endif

testingMessage( "Testing CoinMpsIO\n" );
CoinMpsIOUnitTest(mpsDir);

testingMessage( "Testing CoinLpIO\n" );
CoinLpIOUnitTest(mpsDir);
if (mpsDir != ""){
testingMessage( "Testing CoinMpsIO\n" );
CoinMpsIOUnitTest(mpsDir);

testingMessage( "Testing CoinLpIO\n" );
CoinLpIOUnitTest(mpsDir);
}

testingMessage( "Testing CoinMessageHandler\n" );
if (!CoinMessageHandlerUnitTest())
{ allOK = false ; }
Expand Down

0 comments on commit ddcf710

Please sign in to comment.