Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit ca7b498

Browse files
authored
Header-only mode for Boost unit tests (#848)
A little bit of other cleanup along the way.
1 parent aef38da commit ca7b498

13 files changed

Lines changed: 49 additions & 96 deletions

File tree

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# =============================================================================
2-
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
2+
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
33
#
44
# See top-level LICENSE file for details.
55
# =============================================================================
66
include_directories(${CMAKE_SOURCE_DIR}/coreneuron ${Boost_INCLUDE_DIRS})
77

88
add_executable(alignment_test_bin alignment.cpp)
9-
target_link_libraries(alignment_test_bin ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
109
target_compile_options(alignment_test_bin PRIVATE ${CORENEURON_BOOST_UNIT_TEST_COMPILE_FLAGS})
1110
add_test(NAME alignment_test COMMAND ${TEST_EXEC_PREFIX} $<TARGET_FILE:alignment_test_bin>)
1211
cpp_cc_configure_sanitizers(TARGET alignment_test_bin TEST alignment_test)

tests/unit/alignment/alignment.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
/*
22
# =============================================================================
3-
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
3+
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
44
#
55
# See top-level LICENSE file for details.
66
# =============================================================================.
77
*/
8+
#include "coreneuron/utils/memory.h"
89

9-
10+
#include <boost/mpl/list.hpp>
1011
#define BOOST_TEST_MODULE PaddingCheck
11-
#define BOOST_TEST_MAIN
12+
#include <boost/test/included/unit_test.hpp>
1213

14+
#include <cstdint>
1315
#include <cstring>
14-
#include <stdint.h>
15-
16-
#include <boost/mpl/list.hpp>
17-
#include <boost/test/unit_test.hpp>
18-
19-
#include "coreneuron/utils/memory.h"
2016

2117
template <class T, int n = 1>
2218
struct data {

tests/unit/cmdline_interface/CMakeLists.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
# =============================================================================
2-
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
2+
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
33
#
44
# See top-level LICENSE file for details.
55
# =============================================================================
66
add_executable(cmd_interface_test_bin test_cmdline_interface.cpp)
7-
target_link_libraries(
8-
cmd_interface_test_bin
9-
${MPI_CXX_LIBRARIES}
10-
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
11-
coreneuron
12-
${corenrn_mech_library}
13-
${reportinglib_LIBRARY}
14-
${sonatareport_LIBRARY})
7+
target_link_libraries(cmd_interface_test_bin ${MPI_CXX_LIBRARIES} coreneuron
8+
${corenrn_mech_library} ${reportinglib_LIBRARY} ${sonatareport_LIBRARY})
159
target_include_directories(cmd_interface_test_bin SYSTEM
1610
PRIVATE ${CORENEURON_PROJECT_SOURCE_DIR}/external/CLI11/include)
1711
add_dependencies(cmd_interface_test_bin nrniv-core)

tests/unit/cmdline_interface/test_cmdline_interface.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
#include "coreneuron/apps/corenrn_parameters.hpp"
99

1010
#define BOOST_TEST_MODULE cmdline_interface
11-
#define BOOST_TEST_MAIN
12-
13-
#include <boost/test/unit_test.hpp>
11+
#include <boost/test/included/unit_test.hpp>
1412

1513
#include <cfloat>
1614

tests/unit/interleave_info/CMakeLists.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
# =============================================================================
2-
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
2+
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
33
#
44
# See top-level LICENSE file for details.
55
# =============================================================================
66
add_executable(interleave_info_bin check_constructors.cpp)
7-
target_link_libraries(
8-
interleave_info_bin
9-
${MPI_CXX_LIBRARIES}
10-
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
11-
coreneuron
12-
${corenrn_mech_library}
13-
${reportinglib_LIBRARY}
14-
${sonatareport_LIBRARY})
7+
target_link_libraries(interleave_info_bin ${MPI_CXX_LIBRARIES} coreneuron ${corenrn_mech_library}
8+
${reportinglib_LIBRARY} ${sonatareport_LIBRARY})
159
add_dependencies(interleave_info_bin nrniv-core)
1610
# Tell CMake *not* to run an explicit device code linker step (which will produce errors); let the
1711
# NVHPC C++ compiler handle this implicitly.

tests/unit/interleave_info/check_constructors.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
/*
22
# =============================================================================
3-
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
3+
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
44
#
55
# See top-level LICENSE file for details.
66
# =============================================================================.
77
*/
8+
#include "coreneuron/permute/cellorder.hpp"
89

910
#define BOOST_TEST_MODULE cmdline_interface
10-
#define BOOST_TEST_MAIN
11+
#include <boost/test/included/unit_test.hpp>
1112

12-
#include <boost/test/unit_test.hpp>
13-
#include "coreneuron/permute/cellorder.hpp"
1413
using namespace coreneuron;
14+
1515
BOOST_AUTO_TEST_CASE(interleave_info_test) {
1616
size_t nwarp = 4;
1717
size_t nstride = 6;

tests/unit/lfp/CMakeLists.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# =============================================================================
2-
# Copyright (C) 2016-2020 Blue Brain Project
2+
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
33
#
44
# See top-level LICENSE file for details.
55
# =============================================================================
@@ -8,14 +8,8 @@ include_directories(${CMAKE_SOURCE_DIR}/coreneuron ${Boost_INCLUDE_DIRS})
88
file(GLOB lfp_test_src "*.cpp")
99

1010
add_executable(lfp_test_bin ${lfp_test_src})
11-
target_link_libraries(
12-
lfp_test_bin
13-
${MPI_CXX_LIBRARIES}
14-
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
15-
coreneuron
16-
${corenrn_mech_library}
17-
${reportinglib_LIBRARY}
18-
${sonatareport_LIBRARY})
11+
target_link_libraries(lfp_test_bin ${MPI_CXX_LIBRARIES} coreneuron ${corenrn_mech_library}
12+
${reportinglib_LIBRARY} ${sonatareport_LIBRARY})
1913
# Tell CMake *not* to run an explicit device code linker step (which will produce errors); let the
2014
# NVHPC C++ compiler handle this implicitly.
2115
set_target_properties(lfp_test_bin PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS OFF)

tests/unit/lfp/lfp.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1+
/*
2+
# =============================================================================
3+
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
4+
#
5+
# See top-level LICENSE file for details.
6+
# =============================================================================.
7+
*/
8+
#include "coreneuron/io/lfp.hpp"
9+
#include "coreneuron/mpi/nrnmpi.h"
10+
111
#define BOOST_TEST_MODULE LFPTest
2-
#define BOOST_TEST_MAIN
12+
#include <boost/test/included/unit_test.hpp>
313

414
#include <iostream>
515

6-
#include <boost/test/unit_test.hpp>
7-
8-
#include "coreneuron/io/lfp.hpp"
9-
#include "coreneuron/mpi/nrnmpi.h"
10-
1116
using namespace coreneuron;
1217
using namespace coreneuron::lfputils;
1318

tests/unit/queueing/CMakeLists.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
# =============================================================================
2-
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
2+
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
33
#
44
# See top-level LICENSE file for details.
55
# =============================================================================
66
add_executable(queuing_test_bin test_queueing.cpp)
7-
target_link_libraries(
8-
queuing_test_bin
9-
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
10-
${Boost_SYSTEM_LIBRARY}
11-
coreneuron
12-
${corenrn_mech_library}
13-
${reportinglib_LIBRARY}
14-
${sonatareport_LIBRARY})
7+
target_link_libraries(queuing_test_bin ${Boost_SYSTEM_LIBRARY} coreneuron ${corenrn_mech_library}
8+
${reportinglib_LIBRARY} ${sonatareport_LIBRARY})
159
add_dependencies(queuing_test_bin nrniv-core)
1610
# Tell CMake *not* to run an explicit device code linker step (which will produce errors); let the
1711
# NVHPC C++ compiler handle this implicitly.

tests/unit/queueing/test_header.hpp

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)