Skip to content

Commit

Permalink
Merge pull request #357 from NWChemEx/catch2_v3
Browse files Browse the repository at this point in the history
Update to Catch Version 3
  • Loading branch information
jwaldrop107 authored Sep 11, 2024
2 parents a2b0b06 + 08f896e commit 9d8d4c8
Show file tree
Hide file tree
Showing 60 changed files with 89 additions and 64 deletions.
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ cmaize_option_list(
cmaize_find_or_build_dependency(
utilities
URL github.com/NWChemEx/utilities
VERSION ${NWX_UTILITIES_VERSION}
BUILD_TARGET utilities
FIND_TARGET nwx::utilities
CMAKE_ARGS BUILD_TESTING=${UTILITIES_BUILD_TESTING}
Expand All @@ -53,7 +52,6 @@ cmaize_find_or_build_dependency(
cmaize_find_or_build_dependency(
libfort
URL github.com/seleznevae/libfort
VERSION ${NWX_LIBFORT_VERSION}
BUILD_TARGET fort
FIND_TARGET libfort::fort
CMAKE_ARGS FORT_ENABLE_TESTING=OFF
Expand All @@ -62,7 +60,6 @@ cmaize_find_or_build_dependency(
cmaize_find_or_build_dependency(
parallelzone
URL github.com/NWChemEx/ParallelZone
VERSION ${NWX_PARALLELZONE_VERSION}
BUILD_TARGET parallelzone
FIND_TARGET nwx::parallelzone
CMAKE_ARGS BUILD_TESTING=${PARALLELZONE_BUILD_TESTING}
Expand Down Expand Up @@ -129,7 +126,7 @@ if("${BUILD_TESTING}")
URL github.com/catchorg/Catch2
BUILD_TARGET Catch2
FIND_TARGET Catch2::Catch2
VERSION ${NWX_CATCH2_VERSION}
VERSION v3.6.0
)

cmaize_add_tests(
Expand Down
1 change: 1 addition & 0 deletions src/pluginplay/cache/database/key_injector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "database_api.hpp"
#include <cstdlib>
#include <iostream>
#include <memory>

namespace pluginplay::cache::database {

Expand Down
1 change: 1 addition & 0 deletions src/pluginplay/cache/database/native.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#pragma once
#include "database_api.hpp"
#include <map>
#include <memory>

namespace pluginplay::cache::database {

Expand Down
2 changes: 1 addition & 1 deletion tests/cxx/doc_snippets/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#define CATCH_CONFIG_RUNNER
#include <catch2/catch.hpp>
#include <catch2/catch_session.hpp>
#include <parallelzone/parallelzone.hpp>

int main(int argc, char* argv[]) {
Expand Down
4 changes: 3 additions & 1 deletion tests/cxx/doc_snippets/test_modules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
#include "force.hpp"
#include "load_modules.hpp"
#include "modules.hpp"
#include <catch2/catch.hpp>
#include <catch2/catch_approx.hpp>
#include <catch2/catch_template_test_macros.hpp>
#include <catch2/catch_test_macros.hpp>

using namespace pluginplay_examples;
TEST_CASE("Tutorial modules") {
Expand Down
4 changes: 3 additions & 1 deletion tests/cxx/doc_snippets/test_tutorial_module_documents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/

#include <catch2/catch.hpp>
#include <catch2/catch_approx.hpp>
#include <catch2/catch_template_test_macros.hpp>
#include <catch2/catch_test_macros.hpp>
#include <filesystem>
#include <iterator>
#include <pluginplay/printing/document_modules.hpp>
Expand Down
4 changes: 3 additions & 1 deletion tests/cxx/regression_tests/issue_350.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/

#include "pluginplay/property_type/property_type.hpp"
#include <catch2/catch.hpp>
#include <catch2/catch_approx.hpp>
#include <catch2/catch_template_test_macros.hpp>
#include <catch2/catch_test_macros.hpp>

namespace {
struct FromClass {
Expand Down
2 changes: 1 addition & 1 deletion tests/cxx/regression_tests/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#define CATCH_CONFIG_RUNNER
#include <catch2/catch.hpp>
#include <catch2/catch_session.hpp>
#include <parallelzone/parallelzone.hpp>

int main(int argc, char* argv[]) {
Expand Down
2 changes: 1 addition & 1 deletion tests/cxx/unit_tests/pluginplay/any/test_any.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#pragma once
#include <catch2/catch.hpp>
#include "../catch.hpp"
#include <string>
#include <type_traits>
#include <vector>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include <catch2/catch.hpp>
#include "../../catch.hpp"
#include <pluginplay/cache/database/database_api.hpp>
#include <pluginplay/cache/database/native.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include <catch2/catch.hpp>
#include "../../catch.hpp"
#include <filesystem>
#include <pluginplay/cache/database/database_factory.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include <catch2/catch.hpp>
#include "../../catch.hpp"
#include <pluginplay/cache/database/db_value.hpp>

using namespace pluginplay::cache::database;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#include "../../catch.hpp"
#include "../lexical_cast.hpp"
#include <catch2/catch.hpp>
#include <map>
#include <pluginplay/cache/database/key_injector.hpp>
#include <pluginplay/cache/database/native.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#include "../../catch.hpp"
#include "../test_cache.hpp"
#include <catch2/catch.hpp>
#include <pluginplay/cache/database/make_any.hpp>
#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion tests/cxx/unit_tests/pluginplay/cache/database/native.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include <catch2/catch.hpp>
#include "../../catch.hpp"
#include <pluginplay/cache/database/native.hpp>

using namespace pluginplay::cache::database;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#ifdef BUILD_ROCKS_DB
#include <catch2/catch.hpp>
#include "../../../../catch.hpp"
#include <filesystem>
#include <pluginplay/cache/database/rocksdb/detail_/rocksdb_pimpl.hpp>
using namespace pluginplay::cache::database::detail_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include <catch2/catch.hpp>
#include "../../../../catch.hpp"

/* This unit test ensures that attempting to create a RocksDBPIMPL fails when
* RocksDB support has not been enabled.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include <catch2/catch.hpp>
#include "../../../catch.hpp"
#include <filesystem>
#include <pluginplay/cache/database/rocksdb/rocksdb.hpp>
using namespace pluginplay::cache::database;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#include "../../catch.hpp"
#include "../lexical_cast.hpp"
#include <catch2/catch.hpp>
#include <pluginplay/cache/database/native.hpp>
#include <pluginplay/cache/database/serialized.hpp>
#include <sstream>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#include "../../catch.hpp"
#include "../lexical_cast.hpp"
#include <catch2/catch.hpp>
#include <pluginplay/cache/database/native.hpp>
#include <pluginplay/cache/database/transposer.hpp>

Expand Down
2 changes: 1 addition & 1 deletion tests/cxx/unit_tests/pluginplay/cache/lexical_cast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#include "../catch.hpp"
#include "lexical_cast.hpp"
#include <catch2/catch.hpp>

using namespace testing;

Expand Down
2 changes: 1 addition & 1 deletion tests/cxx/unit_tests/pluginplay/cache/module_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#include "../catch.hpp"
#include "test_cache.hpp"
#include <catch2/catch.hpp>
#include <pluginplay/cache/module_cache.hpp>
#include <pluginplay/cache/module_manager_cache.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include <catch2/catch.hpp>
#include "../catch.hpp"
#include <filesystem>
#include <pluginplay/cache/module_manager_cache.hpp>
#include <pluginplay/config/config.hpp>
Expand Down
2 changes: 1 addition & 1 deletion tests/cxx/unit_tests/pluginplay/cache/test_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#pragma once
#include <catch2/catch.hpp>
#include "../catch.hpp"
#include <pluginplay/cache/database/native.hpp>
#include <pluginplay/cache/database/transposer.hpp>
#include <pluginplay/cache/proxy_map_maker.hpp>
Expand Down
2 changes: 1 addition & 1 deletion tests/cxx/unit_tests/pluginplay/cache/user_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include <catch2/catch.hpp>
#include "../catch.hpp"
#include <pluginplay/cache/module_manager_cache.hpp>
#include <pluginplay/cache/user_cache.hpp>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion tests/cxx/unit_tests/pluginplay/cache/uuid_mapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

#include "../catch.hpp"
#include "lexical_cast.hpp"
#include "test_cache.hpp"
#include <catch2/catch.hpp>
#include <iostream>
#include <pluginplay/any/any.hpp>
#include <pluginplay/cache/database/native.hpp>
Expand Down
20 changes: 20 additions & 0 deletions tests/cxx/unit_tests/pluginplay/catch.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright 2024 NWChemEx-Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once
#include <catch2/catch_approx.hpp>
#include <catch2/catch_template_test_macros.hpp>
#include <catch2/catch_test_macros.hpp>
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* sure we test cv-qualified reference types (ModuleResults are unqualified).
*/

#include <catch2/catch.hpp>
#include "../catch.hpp"
#include <pluginplay/detail_/field_tuple_traits.hpp>
#include <pluginplay/fields/fields.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

#include "../catch.hpp"
#include "../test_common.hpp"
#include "pluginplay/detail_/submodule_request_pimpl.hpp"
#include <catch2/catch.hpp>

using namespace pluginplay::detail_;
using module_ptr = typename SubmoduleRequestPIMPL::module_ptr;
Expand Down
2 changes: 1 addition & 1 deletion tests/cxx/unit_tests/pluginplay/examples/lambda_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

// TUTORIAL_START_SKIP
#include <catch2/catch.hpp>
#include "../catch.hpp"
// TUTORIAL_STOP_SKIP

// TUTORIAL
Expand Down
2 changes: 1 addition & 1 deletion tests/cxx/unit_tests/pluginplay/examples/workflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#include "../catch.hpp"
#include "workflow.hpp"
#include <catch2/catch.hpp>
#include <vector>

TEST_CASE("load_modules") {
Expand Down
10 changes: 5 additions & 5 deletions tests/cxx/unit_tests/pluginplay/examples/writing_a_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

#include "../catch.hpp"
#include "pluginplay/module/detail_/module_pimpl.hpp"
#include "writing_a_module.hpp"
#include <catch2/catch.hpp>

using namespace pluginplay;
using namespace pluginplay::detail_;
Expand Down Expand Up @@ -73,8 +73,8 @@ TEST_CASE("Rectangle Class : run") {
in.at("Dimension 2").change(4.56);
in.at("Name").change("Test");
auto out = r.run(in, r.submods());
REQUIRE(out.at("Area").value<double>() == Approx(5.6088));
REQUIRE(out.at("Perimeter").value<double>() == Approx(11.58));
REQUIRE(out.at("Area").value<double>() == Catch::Approx(5.6088));
REQUIRE(out.at("Perimeter").value<double>() == Catch::Approx(11.58));
REQUIRE(out.at("Summary").value<std::string>() ==
"Test has an area of 5.608800 and a perimeter of 11.580000");
}
Expand Down Expand Up @@ -119,8 +119,8 @@ TEST_CASE("Prism Class : run") {

auto out = r.run(in, submods);
auto [area, volume] = PrismVolume::unwrap_results(out);
REQUIRE(area == Approx(5.6088));
REQUIRE(volume == Approx(44.253432));
REQUIRE(area == Catch::Approx(5.6088));
REQUIRE(volume == Catch::Approx(44.253432));
}

template<size_t N>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#include "../catch.hpp"
#include "writing_a_property_type.hpp"
#include <catch2/catch.hpp>

/* This test focuses on the property_type class. The property_type class can not
* be directly tested as it is an abstract class relying on compile-time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include <catch2/catch.hpp>
#include "../../catch.hpp"
#include <pluginplay/any/any.hpp>
#include <pluginplay/fields/bounds_checking/bounds_checking.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include <catch2/catch.hpp>
#include "../../catch.hpp"
#include <pluginplay/fields/detail_/module_input_pimpl.hpp>

using namespace pluginplay;
Expand Down
Loading

0 comments on commit 9d8d4c8

Please sign in to comment.