COIN-OR::LEMON - Graph Library

Changeset 11:cf6519daa7fa in lemon-benchmark for tests


Ignore:
Timestamp:
12/11/11 11:19:39 (13 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Phase:
public
Message:

Refactoring and test instance in test logs

Location:
tests
Files:
1 added
3 edited
1 moved

Legend:

Unmodified
Added
Removed
  • tests/CMakeLists.txt

    r10 r11  
    11INCLUDE_DIRECTORIES(
    22  ${CMAKE_SOURCE_DIR}/tests
    3   # ${CMAKE_BINARY_DIR}/src
     3  ${CMAKE_BINARY_DIR}/tests
    44)
    55
     
    88)
    99
     10SET(DATADIR_PATH ${CMAKE_BINARY_DIR}/data)
     11CONFIGURE_FILE(
     12  ${CMAKE_CURRENT_SOURCE_DIR}/paths.cc.cmake
     13  ${CMAKE_CURRENT_BINARY_DIR}/paths.cc
     14)
     15
    1016ADD_EXECUTABLE(circulation
    11         circulation.cc main.cc
     17        circulation.cc file_main.cc paths.cc
    1218)
    1319
  • tests/benchmark_tools.h

    r10 r11  
    77#include<lemon/time_measure.h>
    88
    9 extern const char test_name[];
     9extern std::string test_name;
     10extern std::string instance_name;
    1011
    11 inline void logTime(const std::string &subtest_name, const
    12                     lemon::TimeStamp &time)
     12extern const std::string DATADIR_PATH;
     13
     14
     15inline void logTime(const std::string &_instance_name,
     16                    const std::string &subtest_name,
     17                    const lemon::TimeStamp &time)
    1318{
    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)
    1623            << time.realTime() << ' '
    1724            << time.realTime()/(time.userTime()+time.systemTime()) - 1.0
     
    1926}
    2027
     28inline void logTime(const std::string &subtest_name,
     29                    const lemon::TimeStamp &time)
     30{
     31  logTime(instance_name,subtest_name,time);
     32}
     33
    2134#endif
  • tests/circulation.cc

    r10 r11  
    55#include <lemon/dimacs.h>
    66#include <lemon/error.h>
     7#include <istream>
    78
    8 const char test_name[] = "circulation";
     9std::string test_name = "circulation";
    910
    1011using namespace lemon;
    1112
    12 int testMain(int argc, char **argv)
     13int testMain(std::istream &input)
    1314{
    14   if(argc!=2) exit(1);
    15 
    1615  typedef int Value;
    1716 
     
    2524  Timer ti;
    2625  try {
    27     std::ifstream input;
    28     input.open(argv[1]);
    2926    readDimacsMin(input, g, lo_cap, up_cap, cost, sup);
    3027  } catch (FormatError& error) {
     
    3229    return 1;
    3330  }
    34   logTime("file-read",ti);
     31  logTime("fread",ti);
    3532
    3633  Timer tf;
  • tests/file_main.cc

    r10 r11  
    11#include <benchmark_tools.h>
     2#include <istream>
     3#include <lemon/error.h>
    24
    35using namespace lemon;
    46
    5 int testMain(int argc, char **argv);
     7std::string instance_name;
     8
     9int testMain(std::istream &input);
    610
    711int main(int argc, char **argv)
    812{
     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
    920  Timer ti;
    10   testMain(argc, argv);
     21  testMain(input);
    1122  logTime("total",ti);
    1223}
Note: See TracChangeset for help on using the changeset viewer.