diff --git a/readLib/CMakeLists.txt b/readLib/CMakeLists.txt index c62d4fcb580fc290c1f0ae094f0daba5c74cda56..313d20bab8b90d52f6abb53a9c31980888342ebc 100644 --- a/readLib/CMakeLists.txt +++ b/readLib/CMakeLists.txt @@ -1,23 +1,23 @@ find_package (Boost OPTIONAL_COMPONENTS iostreams) -if (Boost_iostreams_FOUND) +if (Boost_IOSTREAMS_FOUND) set ( files source/Interface.boost.cc ) -else (Boost_iostreams_FOUND) +else (Boost_IOSTREAMS_FOUND) message (STATUS "Boost::iostreams not found, data tables need to be unpacked with bunzip2 manually!") set ( files source/Interface.dummy.cc ) -endif (Boost_iostreams_FOUND) +endif (Boost_IOSTREAMS_FOUND) add_library (CorsikaData STATIC ${files}) -if (Boost_iostreams_FOUND) +if (Boost_IOSTREAMS_FOUND) target_link_libraries (CorsikaData PUBLIC Boost::iostreams) -endif (Boost_iostreams_FOUND) +endif (Boost_IOSTREAMS_FOUND) set_target_properties ( CorsikaData @@ -43,9 +43,9 @@ install ( if (COMMAND CORSIKA_ADD_TEST) CORSIKA_ADD_TEST (testData SOURCES source/testData.cc) set (TEST_WITH_BOOST "") - if (Boost_iostreams_FOUND) + if (Boost_IOSTREAMS_FOUND) set (TEST_WITH_BOOST "TEST_WITH_BOOST") - endif (Boost_iostreams_FOUND) + endif (Boost_IOSTREAMS_FOUND) target_compile_definitions ( testData diff --git a/readLib/source/Interface.dummy.cc b/readLib/source/Interface.dummy.cc index 5f851eaf02fc4d69a2523319880935e5c5652800..d8504ac5cf046985550b57fe02a7733ad01597ea 100644 --- a/readLib/source/Interface.dummy.cc +++ b/readLib/source/Interface.dummy.cc @@ -13,28 +13,24 @@ namespace corsika_data { - // the c++ interface functions - // void CorDataOpenFile(const char*) { - // std::runtime_error("Cannot read compressed data files with dummy library."); - //} void CorDataOpenFile(const std::string&) { - std::runtime_error("Cannot read compressed data files with dummy library."); + throw std::runtime_error("Cannot read compressed data files with dummy library."); } void CorDataFillArray(double*, const int&) { - std::runtime_error("Cannot read compressed data files with dummy library."); + throw std::runtime_error("Cannot read compressed data files with dummy library."); } void CorDataCloseFile() { - std::runtime_error("Cannot read compressed data files with dummy library."); + throw std::runtime_error("Cannot read compressed data files with dummy library."); } double CorDataNextNumber() { - std::runtime_error("Cannot read compressed data files with dummy library."); + throw std::runtime_error("Cannot read compressed data files with dummy library."); return 0; } void CorDataNextText(std::string&) { - std::runtime_error("Cannot read compressed data files with dummy library."); + throw std::runtime_error("Cannot read compressed data files with dummy library."); } void CorDataNextText(char*, int) { - std::runtime_error("Cannot read compressed data files with dummy library."); + throw std::runtime_error("Cannot read compressed data files with dummy library."); } bool CorDataCanDeCompress() { return false; } @@ -47,7 +43,7 @@ namespace corsika_data { void cordataclosefile_() { CorDataCloseFile(); } double cordatanextnumber_() { return CorDataNextNumber(); } void cordatanexttext_(char*, int) { - std::runtime_error("Cannot read compressed data files with dummy library."); + throw std::runtime_error("Cannot read compressed data files with dummy library."); } int cordatacandecompress_() { return 0; } } diff --git a/readLib/source/testData.cc b/readLib/source/testData.cc index c5a0a9c44604472b8c3382c2800a1b58fe14a5d6..d4002d905ec109b564f4faa5787a44b829e69f01 100644 --- a/readLib/source/testData.cc +++ b/readLib/source/testData.cc @@ -13,6 +13,7 @@ #include <corsika_data/Interface.h> #include <array> +#include <string> #include <iostream> using namespace std; @@ -33,7 +34,7 @@ TEST_CASE("Data", "[data]") { #ifdef TEST_WITH_BOOST - auto file = GENERATE(fileName, fileNameBZ2); + auto file = GENERATE(as<std::string>{}, fileName, fileNameBZ2); SECTION(std::string("c++,") + file) { bool b = CorDataCanDeCompress(); @@ -104,8 +105,8 @@ TEST_CASE("Data", "[data]") { CHECK_THROWS( cordataclosefile_()); double d = 0; CHECK_THROWS( d = cordatanextnumber_()); - std::string str(" "); - CHECK_THROWS( cordatanexttext_(str.c_str(), 0)); + char* buf = 0; + CHECK_THROWS( cordatanexttext_(buf, 0)); CHECK( cordatacandecompress_() == 0); }