00001
00002
00003
00004
00005 #if defined(_MSC_VER)
00006
00007 # pragma warning(disable:4786)
00008 #endif
00009
00010 #include <cassert>
00011 #include <iostream>
00012
00013 #include "CoinError.hpp"
00014 #include "CoinHelperFunctions.hpp"
00015 #include "CoinSort.hpp"
00016 #include "CoinShallowPackedVector.hpp"
00017 #include "CoinPackedVector.hpp"
00018 #include "CoinDenseVector.hpp"
00019 #include "CoinIndexedVector.hpp"
00020 #include "CoinPackedMatrix.hpp"
00021 #include "CoinMpsIO.hpp"
00022
00023
00024 void testingMessage( const char * const msg );
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 int main (int argc, const char *argv[])
00039 {
00040 int i;
00041
00042
00043 std::set<std::string> definedKeyWords;
00044 definedKeyWords.insert("-mpsDir");
00045 definedKeyWords.insert("-netlibDir");
00046
00047
00048 std::map<std::string,std::string> parms;
00049 for ( i=1; i<argc; i++ ) {
00050 std::string parm(argv[i]);
00051 std::string key,value;
00052 unsigned int eqPos = parm.find('=');
00053
00054
00055 if ( eqPos==std::string::npos ) {
00056
00057 key = parm;
00058 }
00059 else {
00060 key=parm.substr(0,eqPos);
00061 value=parm.substr(eqPos+1);
00062 }
00063
00064
00065 if ( definedKeyWords.find(key) == definedKeyWords.end() ) {
00066
00067
00068 std::cerr <<"Undefined parameter \"" <<key <<"\".\n";
00069 std::cerr <<"Correct usage: \n";
00070 std::cerr <<" unitTest [-mpsDir=V1] [-netlibDir=V2]\n";
00071 std::cerr <<" where:\n";
00072 std::cerr <<" -mpsDir: directory containing mps test files\n";
00073 std::cerr <<" Default value V1=\"../Mps/Sample\"\n";
00074 std::cerr <<" -netlibDir: directory containing netlib files\n";
00075 std::cerr <<" Default value V2=\"../Mps/Netlib\"\n";
00076 return 1;
00077 }
00078 parms[key]=value;
00079 }
00080
00081 const char dirsep = CoinFindDirSeparator();
00082
00083 std::string mpsDir;
00084 if (parms.find("-mpsDir") != parms.end())
00085 mpsDir=parms["-mpsDir"] + dirsep;
00086 else
00087 mpsDir = dirsep == '/' ? "../Mps/Sample/" : "..\\Mps\\Sample\\";
00088
00089
00090 std::string netlibDir;
00091 if (parms.find("-netlibDir") != parms.end())
00092 netlibDir=parms["-netlibDir"] + dirsep;
00093 else
00094 netlibDir = dirsep == '/' ? "../Mps/Netlib/" : "..\\Mps\\Netlib\\";
00095
00096
00097
00098
00099
00100
00101
00102 testingMessage( "Testing CoinError\n" );
00103 CoinErrorUnitTest();
00104
00105 testingMessage( "Testing CoinShallowPackedVector\n" );
00106 CoinShallowPackedVectorUnitTest();
00107
00108 testingMessage( "Testing CoinPackedVector\n" );
00109 CoinPackedVectorUnitTest();
00110
00111 testingMessage( "Testing CoinIndexedVector\n" );
00112 CoinIndexedVectorUnitTest();
00113
00114 testingMessage( "Testing CoinPackedMatrix\n" );
00115 CoinPackedMatrixUnitTest();
00116
00117
00118
00119 #if 1
00120 testingMessage( "Testing CoinDenseVector\n" );
00121
00122 CoinDenseVectorUnitTest<double>(0.0);
00123 CoinDenseVectorUnitTest<float>(0.0f);
00124 #endif
00125
00126
00127 testingMessage( "Testing CoinMpsIO\n" );
00128 CoinMpsIOUnitTest(mpsDir);
00129
00130 testingMessage( "All tests completed successfully\n" );
00131 return 0;
00132 }
00133
00134
00135
00136 void testingMessage( const char * const msg )
00137 {
00138 std::cerr <<msg;
00139
00140
00141 }
00142