Reorganizing tests
Adding test_net_builder and test_reent to cmake build script.
This commit is contained in:
@@ -28,7 +28,7 @@ IF(MSVC)
|
|||||||
ENDIF(MSVC)
|
ENDIF(MSVC)
|
||||||
|
|
||||||
set(Boost_THREAD_FOUND OFF)
|
set(Boost_THREAD_FOUND OFF)
|
||||||
find_package(Boost COMPONENTS unit_test_framework filesystem)
|
find_package(Boost COMPONENTS unit_test_framework filesystem thread)
|
||||||
include_directories (${Boost_INCLUDE_DIRS})
|
include_directories (${Boost_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
|
||||||
@@ -45,41 +45,27 @@ set(toolkit_test_srcs
|
|||||||
# test_pump.cpp
|
# test_pump.cpp
|
||||||
test_pattern.cpp
|
test_pattern.cpp
|
||||||
# test_curve.cpp
|
# test_curve.cpp
|
||||||
test_control.cpp)
|
test_control.cpp
|
||||||
|
test_net_builder.cpp)
|
||||||
|
|
||||||
add_executable(test_toolkit ${toolkit_test_srcs})
|
add_executable(test_toolkit ${toolkit_test_srcs})
|
||||||
|
|
||||||
target_link_libraries(test_toolkit ${Boost_LIBRARIES} epanet2)
|
target_link_libraries(test_toolkit ${Boost_LIBRARIES} epanet2)
|
||||||
|
|
||||||
|
add_test(NAME test_toolkit
|
||||||
|
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_toolkit
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data)
|
||||||
|
|
||||||
|
|
||||||
#I like to keep test files in a separate source directory called test
|
|
||||||
#file(GLOB TEST_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} test_*.cpp)
|
|
||||||
|
|
||||||
#add_library(shared_test OBJECT shared_test.cpp)
|
add_executable(test_reent test_reent.cpp)
|
||||||
|
|
||||||
#Run through each source
|
IF(MSVC)
|
||||||
#foreach(testSrc ${TEST_SRCS})
|
target_link_libraries(test_reent ${Boost_LIBRARIES} epanet2)
|
||||||
# #Extract the filename without an extension (NAME_WE)
|
ELSE(TRUE)
|
||||||
# get_filename_component(testName ${testSrc} NAME_WE)
|
target_link_libraries(test_reent ${Boost_LIBRARIES} pthread epanet2)
|
||||||
#
|
ENDIF(MSVC)
|
||||||
# #Add compile target
|
|
||||||
# IF(${testName} MATCHES "test_reent")
|
add_test(NAME test_reent
|
||||||
# add_executable(${testName} ${testSrc})
|
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_reent
|
||||||
# ELSE (TRUE)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data)
|
||||||
# add_executable(${testName} ${testSrc} $<TARGET_OBJECTS:shared_test>)
|
|
||||||
# ENDIF(${testName} MATCHES "test_reent")
|
|
||||||
#
|
|
||||||
# #link to Boost libraries AND your targets and dependencies
|
|
||||||
# IF(MSVC)
|
|
||||||
# target_link_libraries(${testName} ${Boost_LIBRARIES} epanet2 epanet-output)
|
|
||||||
# ELSE(TRUE)
|
|
||||||
# target_link_libraries(${testName} ${Boost_LIBRARIES} pthread epanet2 epanet-output)
|
|
||||||
# ENDIF(MSVC)
|
|
||||||
#
|
|
||||||
# #Finally add it to test execution
|
|
||||||
# #Notice the WORKING_DIRECTORY and COMMAND
|
|
||||||
# add_test(NAME ${testName}
|
|
||||||
# COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${testName}
|
|
||||||
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data)
|
|
||||||
#endforeach(testSrc)
|
|
||||||
|
|||||||
@@ -11,9 +11,10 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define BOOST_TEST_MODULE "net_builder"
|
#define BOOST_ALL_DYN_LINK
|
||||||
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
#include "shared_test.hpp"
|
#include "test_toolkit.hpp"
|
||||||
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE(test_net_builder)
|
BOOST_AUTO_TEST_SUITE(test_net_builder)
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#define BOOST_ALL_DYN_LINK
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
#include "epanet2_2.h"
|
#include "epanet2_2.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user