test/CMakeLists.txt
author Balazs Dezso <deba@inf.elte.hu>
Sun, 29 Jan 2012 11:28:41 +0100
changeset 979 43a91b33f374
parent 966 c8fce9beb46a
parent 972 1818cc848005
child 994 20ae244b4779
permissions -rw-r--r--
Thread safe map construction and destruction (#223)

It currently support pthread and windows threads.
ladanyi@510
     1
INCLUDE_DIRECTORIES(
ladanyi@549
     2
  ${PROJECT_SOURCE_DIR}
ladanyi@510
     3
  ${PROJECT_BINARY_DIR}
ladanyi@510
     4
)
ladanyi@141
     5
ladanyi@679
     6
LINK_DIRECTORIES(
ladanyi@679
     7
  ${PROJECT_BINARY_DIR}/lemon
ladanyi@679
     8
)
ladanyi@510
     9
alpar@933
    10
SET(TEST_WITH_VALGRIND "NO" CACHE STRING
alpar@933
    11
  "Run the test with valgrind (YES/NO).")
alpar@933
    12
SET(VALGRIND_FLAGS "" CACHE STRING "Valgrind flags used by the tests.")
ladanyi@141
    13
alpar@225
    14
SET(TESTS
deba@488
    15
  adaptors_test
kpeter@698
    16
  bellman_ford_test
ladanyi@141
    17
  bfs_test
alpar@424
    18
  circulation_test
kpeter@649
    19
  connectivity_test
ladanyi@141
    20
  counter_test
ladanyi@141
    21
  dfs_test
ladanyi@141
    22
  digraph_test
kpeter@170
    23
  dijkstra_test
ladanyi@141
    24
  dim_test
deba@488
    25
  edge_set_test
ladanyi@141
    26
  error_test
ladanyi@522
    27
  euler_test
deba@869
    28
  fractional_matching_test
tapolcai@543
    29
  gomory_hu_test
deba@200
    30
  graph_copy_test
ladanyi@141
    31
  graph_test
kpeter@171
    32
  graph_utils_test
deba@410
    33
  hao_orlin_test
deba@203
    34
  heap_test
ladanyi@141
    35
  kruskal_test
alpar@949
    36
  lgf_test
ladanyi@141
    37
  maps_test
kpeter@594
    38
  matching_test
thoneyvazul@916
    39
  max_cardinality_search_test
kpeter@904
    40
  max_clique_test
deba@501
    41
  min_cost_arborescence_test
kpeter@601
    42
  min_cost_flow_test
kpeter@763
    43
  min_mean_cycle_test
deba@913
    44
  nagamochi_ibaraki_test
alpar@424
    45
  path_test
deba@797
    46
  planarity_test
alpar@424
    47
  preflow_test
ladanyi@473
    48
  radix_sort_test
alpar@225
    49
  random_test
alpar@424
    50
  suurballe_test
ladanyi@141
    51
  time_measure_test
ladanyi@679
    52
  unionfind_test
ladanyi@679
    53
)
ladanyi@510
    54
ladanyi@627
    55
IF(LEMON_HAVE_LP)
alpar@927
    56
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@927
    57
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@927
    58
  ELSE()
alpar@927
    59
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@927
    60
  ENDIF()
alpar@927
    61
ladanyi@620
    62
  SET(LP_TEST_LIBS lemon)
ladanyi@679
    63
ladanyi@627
    64
  IF(LEMON_HAVE_GLPK)
ladanyi@620
    65
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@679
    66
  ENDIF()
ladanyi@627
    67
  IF(LEMON_HAVE_CPLEX)
ladanyi@620
    68
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@679
    69
  ENDIF()
ladanyi@627
    70
  IF(LEMON_HAVE_CLP)
ladanyi@621
    71
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@679
    72
  ENDIF()
ladanyi@679
    73
ladanyi@620
    74
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@473
    75
  ADD_TEST(lp_test lp_test)
alpar@945
    76
  ADD_DEPENDENCIES(check lp_test)
ladanyi@473
    77
ladanyi@627
    78
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@473
    79
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@473
    80
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
    81
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@679
    82
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@679
    83
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@679
    84
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
    85
    )
ladanyi@679
    86
  ENDIF()
ladanyi@679
    87
ladanyi@627
    88
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@620
    89
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@620
    90
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
    91
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
alpar@972
    92
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
ladanyi@620
    93
    )
ladanyi@679
    94
  ENDIF()
ladanyi@679
    95
ENDIF()
ladanyi@473
    96
ladanyi@627
    97
IF(LEMON_HAVE_MIP)
alpar@927
    98
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@927
    99
    ADD_EXECUTABLE(mip_test mip_test.cc)
alpar@927
   100
  ELSE()
alpar@927
   101
    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
alpar@927
   102
  ENDIF()
alpar@927
   103
ladanyi@620
   104
  SET(MIP_TEST_LIBS lemon)
ladanyi@679
   105
ladanyi@627
   106
  IF(LEMON_HAVE_GLPK)
ladanyi@620
   107
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@679
   108
  ENDIF()
ladanyi@627
   109
  IF(LEMON_HAVE_CPLEX)
ladanyi@620
   110
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@679
   111
  ENDIF()
ladanyi@627
   112
  IF(LEMON_HAVE_CBC)
ladanyi@621
   113
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@679
   114
  ENDIF()
ladanyi@679
   115
ladanyi@620
   116
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@473
   117
  ADD_TEST(mip_test mip_test)
alpar@945
   118
  ADD_DEPENDENCIES(check mip_test)
ladanyi@473
   119
ladanyi@627
   120
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@473
   121
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@473
   122
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
   123
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@679
   124
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@679
   125
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@679
   126
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
   127
    )
ladanyi@679
   128
  ENDIF()
ladanyi@679
   129
ladanyi@627
   130
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@620
   131
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@620
   132
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
   133
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
alpar@972
   134
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
ladanyi@620
   135
    )
ladanyi@679
   136
  ENDIF()
ladanyi@679
   137
ENDIF()
ladanyi@141
   138
alpar@225
   139
FOREACH(TEST_NAME ${TESTS})
alpar@927
   140
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@927
   141
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@927
   142
  ELSE()
alpar@927
   143
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@927
   144
  ENDIF()
alpar@225
   145
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@933
   146
    IF(TEST_WITH_VALGRIND)
alpar@933
   147
      ADD_TEST(${TEST_NAME}
alpar@933
   148
        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
alpar@933
   149
        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
alpar@933
   150
    ELSE()
alpar@933
   151
      ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@933
   152
    ENDIF()
alpar@927
   153
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@679
   154
ENDFOREACH()