diff --git a/CMakeLists.txt b/CMakeLists.txt index b88229e04f66100aa1ed5be8c0dd998c5489792b..2539e28164c7a4bb3045e466bf6402574021b833 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ set (CMAKE_INSTALL_MESSAGE LAZY) # --std=c++14 set (CMAKE_CXX_STANDARD 14) - +enable_testing () #add_custom_target (corsika_pre_build) #add_custom_command (TARGET corsika_pre_build PRE_BUILD COMMAND "${PROJECT_SOURCE_DIR}/pre_compile.py") diff --git a/Framework/Geometry/CMakeLists.txt b/Framework/Geometry/CMakeLists.txt index c7ca4aa9a1ba3d1293b023e5f0fe278f4dd9c65d..a1f8a8bb6f6f6246edeb670288334a3736f3a8c4 100644 --- a/Framework/Geometry/CMakeLists.txt +++ b/Framework/Geometry/CMakeLists.txt @@ -17,8 +17,15 @@ target_include_directories (CORSIKAgeometry INTERFACE ${EIGEN3_INCLUDE_DIR}) target_include_directories (CORSIKAgeometry INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/Framework> $<INSTALL_INTERFACE:include/Framework> ) - + install (TARGETS CORSIKAgeometry LIBRARY DESTINATION lib ARCHIVE DESTINATION lib PUBLIC_HEADER DESTINATION include/Geometry) + + +# code testing +add_executable (testGeometry testGeometry.cc) +target_link_libraries (testGeometry CORSIKAgeometry CORSIKAunits CORSIKAthirdparty) # for catch2 +add_test (NAME testGeometry COMMAND testGeometry -o report.xml -r junit) + diff --git a/Framework/Geometry/testGeometry.cc b/Framework/Geometry/testGeometry.cc new file mode 100644 index 0000000000000000000000000000000000000000..d5a34b787708214f95b968f1329ecc75bdf513d8 --- /dev/null +++ b/Framework/Geometry/testGeometry.cc @@ -0,0 +1,26 @@ +#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file +#include <ThirdParty/catch2/catch.hpp> + +#include <Units/PhysicalUnits.h> + +using namespace phys::units; +using namespace phys::units::io; +using namespace phys::units::literals; + +TEST_CASE( "PhysicalUnits", "[Units]" ) +{ + SECTION( "sectionOne" ) + { + REQUIRE( 1_m/1_m == 1 ); + } + + SECTION( "sectionTwo" ) + { + REQUIRE_FALSE( 1_m/1_m == 2 ); + } + + SECTION( "sectionThree" ) + { + REQUIRE( 1_s/1_s == 2 ); + } +} diff --git a/Framework/Units/CMakeLists.txt b/Framework/Units/CMakeLists.txt index 4a8245af07199fd8a2baa80adee53073509798cb..d7d3af7ede19a82ed7805cdce046966beff922cb 100644 --- a/Framework/Units/CMakeLists.txt +++ b/Framework/Units/CMakeLists.txt @@ -11,3 +11,8 @@ target_include_directories (CORSIKAunits install (FILES PhysicalUnits.h DESTINATION include/Units) +# code testing +add_executable (testUnits testUnits.cc) +target_link_libraries (testUnits CORSIKAunits CORSIKAthirdparty) # for catch2 +add_test(NAME testUnits COMMAND testUnits) + diff --git a/Framework/Units/testUnits.cc b/Framework/Units/testUnits.cc new file mode 100644 index 0000000000000000000000000000000000000000..eeae88d0fafa133ef9afce1cc6ece2d8157e8dfc --- /dev/null +++ b/Framework/Units/testUnits.cc @@ -0,0 +1,12 @@ +#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file +#include <ThirdParty/catch2/catch.hpp> + +#include <Units/PhysicalUnits.h> + +using namespace phys::units; +using namespace phys::units::io; +using namespace phys::units::literals; + +TEST_CASE( "PhysicalUnits", "[Units]" ) { + REQUIRE( 1_m/1_m == 1 ); +}