test/CMakeLists.txt
author Peter Kovacs <kpeter@inf.elte.hu>
Thu, 15 Nov 2012 07:17:48 +0100
changeset 1179 f6f6896a4724
parent 1152 20ae244b4779
parent 1159 7fdaa05a69a1
child 1186 2e959a5a0c2d
child 1230 caf16813b1e8
permissions -rw-r--r--
Ensure strongly polynomial running time for CycleCanceling (#436)
The number of iterations performed by Howard's algorithm is limited.
If the limit is reached, a strongly polynomial implementation,
HartmannOrlinMmc is executed to find a minimum mean cycle.
This iteration limit is typically not reached, thus the combined
method is practically equivalent to Howard's algorithm, while it
also ensures the strongly polynomial time bound.
ladanyi@539
     1
INCLUDE_DIRECTORIES(
ladanyi@596
     2
  ${PROJECT_SOURCE_DIR}
ladanyi@539
     3
  ${PROJECT_BINARY_DIR}
ladanyi@539
     4
)
ladanyi@141
     5
ladanyi@726
     6
LINK_DIRECTORIES(
ladanyi@726
     7
  ${PROJECT_BINARY_DIR}/lemon
ladanyi@726
     8
)
ladanyi@539
     9
alpar@1044
    10
SET(TEST_WITH_VALGRIND "NO" CACHE STRING
alpar@1044
    11
  "Run the test with valgrind (YES/NO).")
alpar@1044
    12
SET(VALGRIND_FLAGS "" CACHE STRING "Valgrind flags used by the tests.")
ladanyi@141
    13
alpar@225
    14
SET(TESTS
deba@559
    15
  adaptors_test
alpar@1149
    16
  arc_look_up_test
kpeter@745
    17
  bellman_ford_test
ladanyi@141
    18
  bfs_test
alpar@443
    19
  circulation_test
kpeter@696
    20
  connectivity_test
ladanyi@141
    21
  counter_test
ladanyi@141
    22
  dfs_test
ladanyi@141
    23
  digraph_test
kpeter@170
    24
  dijkstra_test
ladanyi@141
    25
  dim_test
deba@559
    26
  edge_set_test
ladanyi@141
    27
  error_test
ladanyi@569
    28
  euler_test
deba@948
    29
  fractional_matching_test
tapolcai@590
    30
  gomory_hu_test
deba@200
    31
  graph_copy_test
ladanyi@141
    32
  graph_test
kpeter@171
    33
  graph_utils_test
deba@426
    34
  hao_orlin_test
deba@203
    35
  heap_test
ladanyi@141
    36
  kruskal_test
alpar@1067
    37
  lgf_test
ladanyi@141
    38
  maps_test
kpeter@641
    39
  matching_test
thoneyvazul@1020
    40
  max_cardinality_search_test
kpeter@999
    41
  max_clique_test
deba@522
    42
  min_cost_arborescence_test
kpeter@648
    43
  min_cost_flow_test
kpeter@810
    44
  min_mean_cycle_test
deba@1017
    45
  nagamochi_ibaraki_test
alpar@443
    46
  path_test
deba@861
    47
  planarity_test
alpar@443
    48
  preflow_test
ladanyi@496
    49
  radix_sort_test
alpar@225
    50
  random_test
alpar@443
    51
  suurballe_test
ladanyi@141
    52
  time_measure_test
ladanyi@726
    53
  unionfind_test
ladanyi@726
    54
)
ladanyi@539
    55
ladanyi@674
    56
IF(LEMON_HAVE_LP)
alpar@1033
    57
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
    58
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@1033
    59
  ELSE()
alpar@1033
    60
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@1033
    61
  ENDIF()
alpar@1033
    62
ladanyi@667
    63
  SET(LP_TEST_LIBS lemon)
ladanyi@726
    64
ladanyi@674
    65
  IF(LEMON_HAVE_GLPK)
ladanyi@667
    66
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@726
    67
  ENDIF()
ladanyi@674
    68
  IF(LEMON_HAVE_CPLEX)
ladanyi@667
    69
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@726
    70
  ENDIF()
ladanyi@674
    71
  IF(LEMON_HAVE_CLP)
ladanyi@668
    72
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@726
    73
  ENDIF()
ladanyi@726
    74
ladanyi@667
    75
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@496
    76
  ADD_TEST(lp_test lp_test)
alpar@1061
    77
  ADD_DEPENDENCIES(check lp_test)
ladanyi@496
    78
ladanyi@674
    79
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@496
    80
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@496
    81
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@496
    82
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@726
    83
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@726
    84
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@726
    85
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@496
    86
    )
ladanyi@726
    87
  ENDIF()
ladanyi@726
    88
ladanyi@674
    89
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@667
    90
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@667
    91
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@667
    92
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
alpar@1119
    93
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
ladanyi@667
    94
    )
ladanyi@726
    95
  ENDIF()
ladanyi@726
    96
ENDIF()
ladanyi@496
    97
ladanyi@674
    98
IF(LEMON_HAVE_MIP)
alpar@1033
    99
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
   100
    ADD_EXECUTABLE(mip_test mip_test.cc)
alpar@1033
   101
  ELSE()
alpar@1033
   102
    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
alpar@1033
   103
  ENDIF()
alpar@1033
   104
ladanyi@667
   105
  SET(MIP_TEST_LIBS lemon)
ladanyi@726
   106
ladanyi@674
   107
  IF(LEMON_HAVE_GLPK)
ladanyi@667
   108
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@726
   109
  ENDIF()
ladanyi@674
   110
  IF(LEMON_HAVE_CPLEX)
ladanyi@667
   111
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@726
   112
  ENDIF()
ladanyi@674
   113
  IF(LEMON_HAVE_CBC)
ladanyi@668
   114
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@726
   115
  ENDIF()
ladanyi@726
   116
ladanyi@667
   117
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@496
   118
  ADD_TEST(mip_test mip_test)
alpar@1061
   119
  ADD_DEPENDENCIES(check mip_test)
ladanyi@496
   120
ladanyi@674
   121
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@496
   122
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@496
   123
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@496
   124
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@726
   125
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@726
   126
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@726
   127
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@496
   128
    )
ladanyi@726
   129
  ENDIF()
ladanyi@726
   130
ladanyi@674
   131
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@667
   132
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@667
   133
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@667
   134
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
alpar@1119
   135
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
ladanyi@667
   136
    )
ladanyi@726
   137
  ENDIF()
ladanyi@726
   138
ENDIF()
ladanyi@141
   139
alpar@225
   140
FOREACH(TEST_NAME ${TESTS})
alpar@1033
   141
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
   142
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@1033
   143
  ELSE()
alpar@1033
   144
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@1033
   145
  ENDIF()
alpar@225
   146
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@1044
   147
    IF(TEST_WITH_VALGRIND)
alpar@1044
   148
      ADD_TEST(${TEST_NAME}
alpar@1044
   149
        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
alpar@1044
   150
        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
alpar@1044
   151
    ELSE()
alpar@1044
   152
      ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@1044
   153
    ENDIF()
alpar@1033
   154
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@726
   155
ENDFOREACH()