Changeset 11:cf6519daa7fa in lemon-benchmark for tests
- Timestamp:
- 12/11/11 11:19:39 (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- tests
- Files:
-
- 1 added
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
tests/CMakeLists.txt
r10 r11 1 1 INCLUDE_DIRECTORIES( 2 2 ${CMAKE_SOURCE_DIR}/tests 3 # ${CMAKE_BINARY_DIR}/src3 ${CMAKE_BINARY_DIR}/tests 4 4 ) 5 5 … … 8 8 ) 9 9 10 SET(DATADIR_PATH ${CMAKE_BINARY_DIR}/data) 11 CONFIGURE_FILE( 12 ${CMAKE_CURRENT_SOURCE_DIR}/paths.cc.cmake 13 ${CMAKE_CURRENT_BINARY_DIR}/paths.cc 14 ) 15 10 16 ADD_EXECUTABLE(circulation 11 circulation.cc main.cc17 circulation.cc file_main.cc paths.cc 12 18 ) 13 19 -
tests/benchmark_tools.h
r10 r11 7 7 #include<lemon/time_measure.h> 8 8 9 extern const char test_name[]; 9 extern std::string test_name; 10 extern std::string instance_name; 10 11 11 inline void logTime(const std::string &subtest_name, const 12 lemon::TimeStamp &time) 12 extern const std::string DATADIR_PATH; 13 14 15 inline void logTime(const std::string &_instance_name, 16 const std::string &subtest_name, 17 const lemon::TimeStamp &time) 13 18 { 14 std::cout << "*** " << test_name << ' ' << subtest_name << ' ' 15 << std::setiosflags(std::ios::fixed) << std::setprecision(4) 19 std::cout << "*** " << test_name 20 << ' ' << _instance_name 21 << ' ' << subtest_name 22 << ' ' << std::setiosflags(std::ios::fixed) << std::setprecision(4) 16 23 << time.realTime() << ' ' 17 24 << time.realTime()/(time.userTime()+time.systemTime()) - 1.0 … … 19 26 } 20 27 28 inline void logTime(const std::string &subtest_name, 29 const lemon::TimeStamp &time) 30 { 31 logTime(instance_name,subtest_name,time); 32 } 33 21 34 #endif -
tests/circulation.cc
r10 r11 5 5 #include <lemon/dimacs.h> 6 6 #include <lemon/error.h> 7 #include <istream> 7 8 8 const char test_name[]= "circulation";9 std::string test_name = "circulation"; 9 10 10 11 using namespace lemon; 11 12 12 int testMain( int argc, char **argv)13 int testMain(std::istream &input) 13 14 { 14 if(argc!=2) exit(1);15 16 15 typedef int Value; 17 16 … … 25 24 Timer ti; 26 25 try { 27 std::ifstream input;28 input.open(argv[1]);29 26 readDimacsMin(input, g, lo_cap, up_cap, cost, sup); 30 27 } catch (FormatError& error) { … … 32 29 return 1; 33 30 } 34 logTime("f ile-read",ti);31 logTime("fread",ti); 35 32 36 33 Timer tf; -
tests/file_main.cc
r10 r11 1 1 #include <benchmark_tools.h> 2 #include <istream> 3 #include <lemon/error.h> 2 4 3 5 using namespace lemon; 4 6 5 int testMain(int argc, char **argv); 7 std::string instance_name; 8 9 int testMain(std::istream &input); 6 10 7 11 int main(int argc, char **argv) 8 12 { 13 if(argc!=2) exit(1); 14 15 std::ifstream input; 16 input.open((DATADIR_PATH+"/"+argv[1]).c_str()); 17 18 instance_name = argv[1]; 19 9 20 Timer ti; 10 testMain( argc, argv);21 testMain(input); 11 22 logTime("total",ti); 12 23 }
Note: See TracChangeset
for help on using the changeset viewer.