From 1e39a307c6088c7a2f7f0a9f7d8e2d5cf8f748e3 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 28 Aug 2024 14:11:10 -0500 Subject: [PATCH 01/13] clang-format: separate system and third-party headers from driver headers --- .clang-format | 20 ++++++++++++------- src/bsoncxx/test/array.cpp | 3 ++- src/bsoncxx/test/bson_b_date.cpp | 3 ++- src/bsoncxx/test/bson_builder.cpp | 3 ++- src/bsoncxx/test/bson_get_values.cpp | 1 + src/bsoncxx/test/bson_serialization.cpp | 3 ++- src/bsoncxx/test/bson_types.cpp | 3 ++- src/bsoncxx/test/bson_util_itoa.cpp | 1 + src/bsoncxx/test/bson_validate.cpp | 3 ++- src/bsoncxx/test/bson_value.cpp | 3 ++- src/bsoncxx/test/catch.hh | 6 ++++-- src/bsoncxx/test/exception_guard.hh | 3 ++- src/bsoncxx/test/json.cpp | 1 + src/bsoncxx/test/make_unique.test.cpp | 1 + src/bsoncxx/test/oid.cpp | 1 + src/bsoncxx/test/optional.test.cpp | 3 ++- src/bsoncxx/test/string_view.test.cpp | 3 ++- src/bsoncxx/test/type_traits.test.cpp | 3 ++- src/bsoncxx/test/view_or_value.cpp | 1 + src/mongocxx/test/bulk_write.cpp | 5 +++-- src/mongocxx/test/change_streams.cpp | 6 ++++-- src/mongocxx/test/client.cpp | 8 +++++--- src/mongocxx/test/client_helpers.cpp | 5 +++-- src/mongocxx/test/client_helpers.hh | 3 ++- src/mongocxx/test/client_session.cpp | 4 +++- src/mongocxx/test/client_side_encryption.cpp | 10 ++++++---- src/mongocxx/test/collection.cpp | 7 ++++--- src/mongocxx/test/collection_mocked.cpp | 4 +++- src/mongocxx/test/conversions.cpp | 3 ++- src/mongocxx/test/database.cpp | 4 +++- src/mongocxx/test/gridfs/bucket.cpp | 5 +++-- src/mongocxx/test/gridfs/downloader.cpp | 3 ++- src/mongocxx/test/gridfs/uploader.cpp | 3 ++- src/mongocxx/test/hint.cpp | 3 ++- src/mongocxx/test/index_view.cpp | 3 ++- src/mongocxx/test/instance.cpp | 3 ++- src/mongocxx/test/logging.cpp | 3 ++- src/mongocxx/test/model/delete_many.cpp | 4 +++- src/mongocxx/test/model/delete_one.cpp | 4 +++- src/mongocxx/test/model/insert_one.cpp | 3 ++- src/mongocxx/test/model/replace_one.cpp | 4 +++- src/mongocxx/test/model/update_many.cpp | 4 +++- src/mongocxx/test/model/update_one.cpp | 4 +++- src/mongocxx/test/options/aggregate.cpp | 4 +++- src/mongocxx/test/options/bulk_write.cpp | 4 +++- src/mongocxx/test/options/client_session.cpp | 3 ++- src/mongocxx/test/options/count.cpp | 4 +++- .../test/options/create_collection.cpp | 4 +++- src/mongocxx/test/options/delete.cpp | 4 +++- src/mongocxx/test/options/distinct.cpp | 4 +++- src/mongocxx/test/options/find.cpp | 4 +++- .../test/options/find_one_and_delete.cpp | 4 +++- .../test/options/find_one_and_replace.cpp | 4 +++- .../test/options/find_one_and_update.cpp | 4 +++- src/mongocxx/test/options/gridfs/bucket.cpp | 4 +++- src/mongocxx/test/options/gridfs/upload.cpp | 4 +++- src/mongocxx/test/options/index.cpp | 4 +++- src/mongocxx/test/options/insert.cpp | 4 +++- src/mongocxx/test/options/pool.cpp | 3 ++- src/mongocxx/test/options/replace.cpp | 4 +++- src/mongocxx/test/options/update.cpp | 4 +++- src/mongocxx/test/pool.cpp | 6 ++++-- src/mongocxx/test/private/numeric_casting.cpp | 3 ++- src/mongocxx/test/private/scoped_bson_t.cpp | 3 ++- src/mongocxx/test/private/write_concern.cpp | 3 ++- src/mongocxx/test/read_concern.cpp | 3 ++- src/mongocxx/test/read_preference.cpp | 4 +++- src/mongocxx/test/result/bulk_write.cpp | 3 ++- src/mongocxx/test/result/delete.cpp | 3 ++- src/mongocxx/test/result/gridfs/upload.cpp | 3 ++- src/mongocxx/test/result/insert_one.cpp | 3 ++- src/mongocxx/test/result/replace_one.cpp | 3 ++- src/mongocxx/test/result/update.cpp | 3 ++- src/mongocxx/test/sdam-monitoring.cpp | 5 +++-- src/mongocxx/test/search_index_view.cpp | 3 ++- .../test/spec/client_side_encryption.cpp | 3 ++- src/mongocxx/test/spec/command_monitoring.cpp | 5 +++-- src/mongocxx/test/spec/crud.cpp | 3 ++- src/mongocxx/test/spec/gridfs.cpp | 3 ++- .../spec/initial_dns_seedlist_discovery.cpp | 3 ++- src/mongocxx/test/spec/mongohouse.cpp | 3 ++- src/mongocxx/test/spec/monitoring.cpp | 7 ++++--- src/mongocxx/test/spec/monitoring.hh | 5 +++-- src/mongocxx/test/spec/operation.cpp | 5 +++-- src/mongocxx/test/spec/read_write_concern.cpp | 3 ++- src/mongocxx/test/spec/retryable-reads.cpp | 3 ++- src/mongocxx/test/spec/transactions.cpp | 3 ++- .../test/spec/unified_tests/assert.cpp | 5 +++-- .../test/spec/unified_tests/assert.hh | 1 + .../test/spec/unified_tests/operations.cpp | 5 +++-- .../test/spec/unified_tests/operations.hh | 6 ++++-- .../test/spec/unified_tests/runner.cpp | 10 ++++++---- src/mongocxx/test/spec/uri_options.cpp | 3 ++- src/mongocxx/test/spec/util.cpp | 7 ++++--- src/mongocxx/test/spec/util.hh | 3 ++- src/mongocxx/test/transactions.cpp | 3 ++- src/mongocxx/test/uri.cpp | 3 ++- src/mongocxx/test/validation_criteria.cpp | 4 +++- src/mongocxx/test/versioned_api.cpp | 5 +++-- src/mongocxx/test/write_concern.cpp | 3 ++- 100 files changed, 265 insertions(+), 127 deletions(-) diff --git a/.clang-format b/.clang-format index 41a2d0fb3c..e5417c4504 100644 --- a/.clang-format +++ b/.clang-format @@ -10,14 +10,20 @@ Cpp11BracedListStyle: true DerivePointerAlignment: false IncludeBlocks: Regroup IncludeCategories: - - Regex: 'prelude\.(hpp|hh)' # preludes - Priority: 4 + - Regex: '".*"' # relative headers + Priority: 10 + - Regex: '(bsoncxx|mongocxx)/config(/private)?/prelude\.(hpp|hh)' # v_noabi preludes + Priority: 50 + - Regex: '(bsoncxx|mongocxx)/test/.*' # test headers + Priority: 60 - Regex: '<[[:alnum:]_.]+>' # system headers - Priority: 1 - - Regex: '.*(-|\/)fwd\.(hpp|hh)' # forwarding headers - Priority: 2 - - Regex: '.*' # driver headers - Priority: 3 + Priority: 20 + - Regex: '(bsoncxx|mongocxx)/.*(-|\/)fwd\.(hpp|hh)' # all driver forwarding headers + Priority: 30 + - Regex: '(bsoncxx|mongocxx)/.*' # all remaining (normal) driver headers + Priority: 40 + - Regex: '.*' # all other headers (third party) + Priority: 90 IndentWidth: 4 MaxEmptyLinesToKeep: 1 NamespaceIndentation: None diff --git a/src/bsoncxx/test/array.cpp b/src/bsoncxx/test/array.cpp index b8743710b4..bfad640fbb 100644 --- a/src/bsoncxx/test/array.cpp +++ b/src/bsoncxx/test/array.cpp @@ -14,10 +14,11 @@ #include #include -#include #include #include +#include + namespace { using namespace bsoncxx; diff --git a/src/bsoncxx/test/bson_b_date.cpp b/src/bsoncxx/test/bson_b_date.cpp index 694010faa9..abe4274b7f 100644 --- a/src/bsoncxx/test/bson_b_date.cpp +++ b/src/bsoncxx/test/bson_b_date.cpp @@ -14,9 +14,10 @@ #include -#include #include +#include + namespace { TEST_CASE("time_point is converted to b_date and back", "[bsoncxx::types::b_date]") { using bsoncxx::types::b_date; diff --git a/src/bsoncxx/test/bson_builder.cpp b/src/bsoncxx/test/bson_builder.cpp index 134af723af..f94fe1ce46 100644 --- a/src/bsoncxx/test/bson_builder.cpp +++ b/src/bsoncxx/test/bson_builder.cpp @@ -24,10 +24,11 @@ #include #include #include -#include #include #include +#include + namespace { using namespace bsoncxx; diff --git a/src/bsoncxx/test/bson_get_values.cpp b/src/bsoncxx/test/bson_get_values.cpp index 9377894015..7cbe813bca 100644 --- a/src/bsoncxx/test/bson_get_values.cpp +++ b/src/bsoncxx/test/bson_get_values.cpp @@ -17,6 +17,7 @@ #include #include #include + #include namespace { diff --git a/src/bsoncxx/test/bson_serialization.cpp b/src/bsoncxx/test/bson_serialization.cpp index c95f5b9db4..e7261cd5ba 100644 --- a/src/bsoncxx/test/bson_serialization.cpp +++ b/src/bsoncxx/test/bson_serialization.cpp @@ -17,9 +17,10 @@ #include #include #include -#include #include +#include + namespace { using namespace bsoncxx; diff --git a/src/bsoncxx/test/bson_types.cpp b/src/bsoncxx/test/bson_types.cpp index 4545587d96..2cb81d9f60 100644 --- a/src/bsoncxx/test/bson_types.cpp +++ b/src/bsoncxx/test/bson_types.cpp @@ -18,10 +18,11 @@ #include #include #include -#include #include #include +#include + namespace { using namespace bsoncxx; diff --git a/src/bsoncxx/test/bson_util_itoa.cpp b/src/bsoncxx/test/bson_util_itoa.cpp index 4f617dbd4a..463e576838 100644 --- a/src/bsoncxx/test/bson_util_itoa.cpp +++ b/src/bsoncxx/test/bson_util_itoa.cpp @@ -13,6 +13,7 @@ // limitations under the License. #include + #include namespace { diff --git a/src/bsoncxx/test/bson_validate.cpp b/src/bsoncxx/test/bson_validate.cpp index 7c43eb43a9..8970c38fe9 100644 --- a/src/bsoncxx/test/bson_validate.cpp +++ b/src/bsoncxx/test/bson_validate.cpp @@ -18,9 +18,10 @@ #include #include #include -#include #include +#include + namespace { using namespace bsoncxx; diff --git a/src/bsoncxx/test/bson_value.cpp b/src/bsoncxx/test/bson_value.cpp index 30bbbd4f20..e5d80164ec 100644 --- a/src/bsoncxx/test/bson_value.cpp +++ b/src/bsoncxx/test/bson_value.cpp @@ -19,11 +19,12 @@ #include #include #include -#include #include #include #include +#include + namespace { using namespace bsoncxx; diff --git a/src/bsoncxx/test/catch.hh b/src/bsoncxx/test/catch.hh index 859c9b96e3..34ef57ae0c 100644 --- a/src/bsoncxx/test/catch.hh +++ b/src/bsoncxx/test/catch.hh @@ -19,11 +19,13 @@ #include #include #include -#include -#include #include +#include + +#include + namespace Catch { using namespace bsoncxx; diff --git a/src/bsoncxx/test/exception_guard.hh b/src/bsoncxx/test/exception_guard.hh index 61282b46b3..d6a29b45d0 100644 --- a/src/bsoncxx/test/exception_guard.hh +++ b/src/bsoncxx/test/exception_guard.hh @@ -22,10 +22,11 @@ #include #include -#include #include +#include + namespace bsoncxx { namespace test { diff --git a/src/bsoncxx/test/json.cpp b/src/bsoncxx/test/json.cpp index 7fe7963142..5e0b380e05 100644 --- a/src/bsoncxx/test/json.cpp +++ b/src/bsoncxx/test/json.cpp @@ -19,6 +19,7 @@ #include #include #include + #include namespace { diff --git a/src/bsoncxx/test/make_unique.test.cpp b/src/bsoncxx/test/make_unique.test.cpp index 73ef238521..a71792448e 100644 --- a/src/bsoncxx/test/make_unique.test.cpp +++ b/src/bsoncxx/test/make_unique.test.cpp @@ -3,6 +3,7 @@ #include #include + #include namespace { diff --git a/src/bsoncxx/test/oid.cpp b/src/bsoncxx/test/oid.cpp index 0603db3975..50a43de820 100644 --- a/src/bsoncxx/test/oid.cpp +++ b/src/bsoncxx/test/oid.cpp @@ -21,6 +21,7 @@ #include #include + #include using namespace bsoncxx; diff --git a/src/bsoncxx/test/optional.test.cpp b/src/bsoncxx/test/optional.test.cpp index d3de72e132..904eaebc72 100644 --- a/src/bsoncxx/test/optional.test.cpp +++ b/src/bsoncxx/test/optional.test.cpp @@ -10,10 +10,11 @@ #include #include #include -#include #include +#include + // Each polyfill library has some set of features that are not conformant with the standard // specification (inconsistent, missing, etc.). Limit testing to bsoncxx implementation and stdlib. #if defined(BSONCXX_POLY_USE_IMPLS) || defined(BSONCXX_POLY_USE_STD) diff --git a/src/bsoncxx/test/string_view.test.cpp b/src/bsoncxx/test/string_view.test.cpp index b9ca5874bf..76bcf2c1e5 100644 --- a/src/bsoncxx/test/string_view.test.cpp +++ b/src/bsoncxx/test/string_view.test.cpp @@ -17,10 +17,11 @@ #include #include #include -#include #include +#include + namespace stdx = bsoncxx::stdx; using stdx::string_view; diff --git a/src/bsoncxx/test/type_traits.test.cpp b/src/bsoncxx/test/type_traits.test.cpp index dc14cbbefa..62354afe79 100644 --- a/src/bsoncxx/test/type_traits.test.cpp +++ b/src/bsoncxx/test/type_traits.test.cpp @@ -2,10 +2,11 @@ #include #include -#include #include +#include + // We declare variables that are only used for compilation checking BSONCXX_DISABLE_WARNING(GNU("-Wunused")); diff --git a/src/bsoncxx/test/view_or_value.cpp b/src/bsoncxx/test/view_or_value.cpp index 7808f5e2ed..1e01f96656 100644 --- a/src/bsoncxx/test/view_or_value.cpp +++ b/src/bsoncxx/test/view_or_value.cpp @@ -19,6 +19,7 @@ #include #include #include + #include namespace { diff --git a/src/mongocxx/test/bulk_write.cpp b/src/mongocxx/test/bulk_write.cpp index 66eb45a669..5266b9c34f 100644 --- a/src/mongocxx/test/bulk_write.cpp +++ b/src/mongocxx/test/bulk_write.cpp @@ -13,15 +13,16 @@ // limitations under the License. #include -#include #include #include #include #include #include -#include #include +#include +#include + namespace { using namespace mongocxx; diff --git a/src/mongocxx/test/change_streams.cpp b/src/mongocxx/test/change_streams.cpp index 4137f63abf..d06d2c0a01 100644 --- a/src/mongocxx/test/change_streams.cpp +++ b/src/mongocxx/test/change_streams.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -27,8 +26,11 @@ #include #include #include -#include #include + +#include +#include + #include namespace { diff --git a/src/mongocxx/test/client.cpp b/src/mongocxx/test/client.cpp index 0ceacda416..b357ab3836 100644 --- a/src/mongocxx/test/client.cpp +++ b/src/mongocxx/test/client.cpp @@ -13,19 +13,21 @@ // limitations under the License. #include -#include #include #include #include #include #include #include -#include #include -#include #include +#include +#include + +#include + namespace { using namespace mongocxx; diff --git a/src/mongocxx/test/client_helpers.cpp b/src/mongocxx/test/client_helpers.cpp index 42369ac3ba..64e0137eaf 100644 --- a/src/mongocxx/test/client_helpers.cpp +++ b/src/mongocxx/test/client_helpers.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -36,10 +35,12 @@ #include #include #include -#include #include +#include +#include + namespace mongocxx { namespace test_util { diff --git a/src/mongocxx/test/client_helpers.hh b/src/mongocxx/test/client_helpers.hh index 275a98cfef..e89a73b270 100644 --- a/src/mongocxx/test/client_helpers.hh +++ b/src/mongocxx/test/client_helpers.hh @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -35,6 +34,8 @@ #include +#include + namespace mongocxx { namespace test_util { diff --git a/src/mongocxx/test/client_session.cpp b/src/mongocxx/test/client_session.cpp index cd5edc4218..0ec100e37b 100644 --- a/src/mongocxx/test/client_session.cpp +++ b/src/mongocxx/test/client_session.cpp @@ -16,14 +16,16 @@ #include #include -#include #include #include #include #include #include #include + +#include #include + #include namespace { diff --git a/src/mongocxx/test/client_side_encryption.cpp b/src/mongocxx/test/client_side_encryption.cpp index d7ffbc0dc6..904d5c9005 100644 --- a/src/mongocxx/test/client_side_encryption.cpp +++ b/src/mongocxx/test/client_side_encryption.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -37,14 +36,17 @@ #include #include #include -#include -#include #include #include -#include #include +#include +#include +#include + +#include + namespace { const auto kLocalMasterKey = "\x32\x78\x34\x34\x2b\x78\x64\x75\x54\x61\x42\x42\x6b\x59\x31\x36\x45\x72" diff --git a/src/mongocxx/test/collection.cpp b/src/mongocxx/test/collection.cpp index 7a6c549150..c27b0b67a8 100644 --- a/src/mongocxx/test/collection.cpp +++ b/src/mongocxx/test/collection.cpp @@ -23,8 +23,6 @@ #include #include #include -#include -#include #include #include #include @@ -38,9 +36,12 @@ #include #include #include -#include #include +#include +#include +#include + namespace { using bsoncxx::builder::basic::document; diff --git a/src/mongocxx/test/collection_mocked.cpp b/src/mongocxx/test/collection_mocked.cpp index 8d567ef434..6238451dcd 100644 --- a/src/mongocxx/test/collection_mocked.cpp +++ b/src/mongocxx/test/collection_mocked.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -34,6 +33,9 @@ #include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/conversions.cpp b/src/mongocxx/test/conversions.cpp index b39226cad5..6198e8ad5f 100644 --- a/src/mongocxx/test/conversions.cpp +++ b/src/mongocxx/test/conversions.cpp @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include #include +#include + namespace { using namespace mongocxx; diff --git a/src/mongocxx/test/database.cpp b/src/mongocxx/test/database.cpp index 5ddb53b538..e82f6461ff 100644 --- a/src/mongocxx/test/database.cpp +++ b/src/mongocxx/test/database.cpp @@ -16,7 +16,6 @@ #include #include -#include #include #include #include @@ -27,7 +26,10 @@ #include #include #include + +#include #include + #include namespace { diff --git a/src/mongocxx/test/gridfs/bucket.cpp b/src/mongocxx/test/gridfs/bucket.cpp index f888bc444b..6db8a48276 100644 --- a/src/mongocxx/test/gridfs/bucket.cpp +++ b/src/mongocxx/test/gridfs/bucket.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -38,9 +37,11 @@ #include #include #include -#include #include +#include +#include + namespace { using namespace mongocxx; diff --git a/src/mongocxx/test/gridfs/downloader.cpp b/src/mongocxx/test/gridfs/downloader.cpp index 7e7a4dcd83..376b13b029 100644 --- a/src/mongocxx/test/gridfs/downloader.cpp +++ b/src/mongocxx/test/gridfs/downloader.cpp @@ -12,11 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include #include #include +#include + namespace { using namespace mongocxx; diff --git a/src/mongocxx/test/gridfs/uploader.cpp b/src/mongocxx/test/gridfs/uploader.cpp index 4df52710cb..ee0781186c 100644 --- a/src/mongocxx/test/gridfs/uploader.cpp +++ b/src/mongocxx/test/gridfs/uploader.cpp @@ -14,10 +14,11 @@ #include -#include #include #include +#include + namespace { using namespace mongocxx; diff --git a/src/mongocxx/test/hint.cpp b/src/mongocxx/test/hint.cpp index 1fcb8777cf..d782647524 100644 --- a/src/mongocxx/test/hint.cpp +++ b/src/mongocxx/test/hint.cpp @@ -16,10 +16,11 @@ #include #include #include -#include #include #include +#include + namespace { using namespace mongocxx; using namespace bsoncxx; diff --git a/src/mongocxx/test/index_view.cpp b/src/mongocxx/test/index_view.cpp index bdbe58309a..c85b1f5306 100644 --- a/src/mongocxx/test/index_view.cpp +++ b/src/mongocxx/test/index_view.cpp @@ -17,7 +17,6 @@ #include #include -#include #include #include #include @@ -25,6 +24,8 @@ #include #include #include + +#include #include namespace { diff --git a/src/mongocxx/test/instance.cpp b/src/mongocxx/test/instance.cpp index 3c15029470..047bf52a61 100644 --- a/src/mongocxx/test/instance.cpp +++ b/src/mongocxx/test/instance.cpp @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include #include +#include + namespace { using namespace mongocxx; diff --git a/src/mongocxx/test/logging.cpp b/src/mongocxx/test/logging.cpp index 90a4ff1600..6dc924320a 100644 --- a/src/mongocxx/test/logging.cpp +++ b/src/mongocxx/test/logging.cpp @@ -15,11 +15,12 @@ #include #include -#include #include #include #include +#include + namespace { using namespace mongocxx; diff --git a/src/mongocxx/test/model/delete_many.cpp b/src/mongocxx/test/model/delete_many.cpp index c2d4bbf40e..a98100d3b1 100644 --- a/src/mongocxx/test/model/delete_many.cpp +++ b/src/mongocxx/test/model/delete_many.cpp @@ -13,9 +13,11 @@ // limitations under the License. #include -#include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/model/delete_one.cpp b/src/mongocxx/test/model/delete_one.cpp index 81717c3586..492519f2b8 100644 --- a/src/mongocxx/test/model/delete_one.cpp +++ b/src/mongocxx/test/model/delete_one.cpp @@ -13,9 +13,11 @@ // limitations under the License. #include -#include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/model/insert_one.cpp b/src/mongocxx/test/model/insert_one.cpp index 46ee974890..e7b9cddf94 100644 --- a/src/mongocxx/test/model/insert_one.cpp +++ b/src/mongocxx/test/model/insert_one.cpp @@ -13,10 +13,11 @@ // limitations under the License. #include -#include #include #include +#include + namespace { using namespace bsoncxx::builder::basic; diff --git a/src/mongocxx/test/model/replace_one.cpp b/src/mongocxx/test/model/replace_one.cpp index 1066e81d35..182d676dc2 100644 --- a/src/mongocxx/test/model/replace_one.cpp +++ b/src/mongocxx/test/model/replace_one.cpp @@ -13,9 +13,11 @@ // limitations under the License. #include -#include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/model/update_many.cpp b/src/mongocxx/test/model/update_many.cpp index 012d0568fc..0f43c95d9a 100644 --- a/src/mongocxx/test/model/update_many.cpp +++ b/src/mongocxx/test/model/update_many.cpp @@ -14,9 +14,11 @@ #include #include -#include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/model/update_one.cpp b/src/mongocxx/test/model/update_one.cpp index ad80dac84a..87d22b43f1 100644 --- a/src/mongocxx/test/model/update_one.cpp +++ b/src/mongocxx/test/model/update_one.cpp @@ -14,9 +14,11 @@ #include #include -#include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/options/aggregate.cpp b/src/mongocxx/test/options/aggregate.cpp index 97397be48d..b56dc4e80c 100644 --- a/src/mongocxx/test/options/aggregate.cpp +++ b/src/mongocxx/test/options/aggregate.cpp @@ -16,9 +16,11 @@ #include #include -#include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/options/bulk_write.cpp b/src/mongocxx/test/options/bulk_write.cpp index 0c81fd5021..a253ece3c8 100644 --- a/src/mongocxx/test/options/bulk_write.cpp +++ b/src/mongocxx/test/options/bulk_write.cpp @@ -12,9 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/options/client_session.cpp b/src/mongocxx/test/options/client_session.cpp index 5628b2d983..2a0c132675 100644 --- a/src/mongocxx/test/options/client_session.cpp +++ b/src/mongocxx/test/options/client_session.cpp @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include #include +#include + namespace { using namespace mongocxx; diff --git a/src/mongocxx/test/options/count.cpp b/src/mongocxx/test/options/count.cpp index ef8f01b453..5048c8007d 100644 --- a/src/mongocxx/test/options/count.cpp +++ b/src/mongocxx/test/options/count.cpp @@ -15,9 +15,11 @@ #include #include -#include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/options/create_collection.cpp b/src/mongocxx/test/options/create_collection.cpp index 9fdd51fbe1..194672fe92 100644 --- a/src/mongocxx/test/options/create_collection.cpp +++ b/src/mongocxx/test/options/create_collection.cpp @@ -16,11 +16,13 @@ #include #include #include -#include #include #include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/options/delete.cpp b/src/mongocxx/test/options/delete.cpp index 4d70db089a..c91f2b3107 100644 --- a/src/mongocxx/test/options/delete.cpp +++ b/src/mongocxx/test/options/delete.cpp @@ -15,9 +15,11 @@ #include #include -#include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/options/distinct.cpp b/src/mongocxx/test/options/distinct.cpp index b5962deb50..5482bcea4a 100644 --- a/src/mongocxx/test/options/distinct.cpp +++ b/src/mongocxx/test/options/distinct.cpp @@ -15,9 +15,11 @@ #include #include -#include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/options/find.cpp b/src/mongocxx/test/options/find.cpp index 8214ed5c66..e5fb5e1e9e 100644 --- a/src/mongocxx/test/options/find.cpp +++ b/src/mongocxx/test/options/find.cpp @@ -15,9 +15,11 @@ #include #include -#include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/options/find_one_and_delete.cpp b/src/mongocxx/test/options/find_one_and_delete.cpp index 196b76768d..0f617ceb9a 100644 --- a/src/mongocxx/test/options/find_one_and_delete.cpp +++ b/src/mongocxx/test/options/find_one_and_delete.cpp @@ -15,9 +15,11 @@ #include #include -#include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/options/find_one_and_replace.cpp b/src/mongocxx/test/options/find_one_and_replace.cpp index 5e5f704fa0..1fb43e6339 100644 --- a/src/mongocxx/test/options/find_one_and_replace.cpp +++ b/src/mongocxx/test/options/find_one_and_replace.cpp @@ -15,9 +15,11 @@ #include #include -#include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/options/find_one_and_update.cpp b/src/mongocxx/test/options/find_one_and_update.cpp index 6f31620875..8df41608c1 100644 --- a/src/mongocxx/test/options/find_one_and_update.cpp +++ b/src/mongocxx/test/options/find_one_and_update.cpp @@ -16,9 +16,11 @@ #include #include -#include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/options/gridfs/bucket.cpp b/src/mongocxx/test/options/gridfs/bucket.cpp index 1f57c84cd8..ddeaf8a39e 100644 --- a/src/mongocxx/test/options/gridfs/bucket.cpp +++ b/src/mongocxx/test/options/gridfs/bucket.cpp @@ -12,12 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include #include #include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/options/gridfs/upload.cpp b/src/mongocxx/test/options/gridfs/upload.cpp index cbc2a9c606..635a055b0e 100644 --- a/src/mongocxx/test/options/gridfs/upload.cpp +++ b/src/mongocxx/test/options/gridfs/upload.cpp @@ -14,9 +14,11 @@ #include #include -#include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/options/index.cpp b/src/mongocxx/test/options/index.cpp index 2f177108e7..d65180239a 100644 --- a/src/mongocxx/test/options/index.cpp +++ b/src/mongocxx/test/options/index.cpp @@ -14,10 +14,12 @@ #include #include -#include #include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/options/insert.cpp b/src/mongocxx/test/options/insert.cpp index e851d4267d..b425e83a2b 100644 --- a/src/mongocxx/test/options/insert.cpp +++ b/src/mongocxx/test/options/insert.cpp @@ -12,9 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/options/pool.cpp b/src/mongocxx/test/options/pool.cpp index 31b28e5401..61e2b7f92c 100644 --- a/src/mongocxx/test/options/pool.cpp +++ b/src/mongocxx/test/options/pool.cpp @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include #include +#include + namespace { using namespace mongocxx; diff --git a/src/mongocxx/test/options/replace.cpp b/src/mongocxx/test/options/replace.cpp index 6840aac6e6..17b2b17ac9 100644 --- a/src/mongocxx/test/options/replace.cpp +++ b/src/mongocxx/test/options/replace.cpp @@ -13,9 +13,11 @@ // limitations under the License. #include -#include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/options/update.cpp b/src/mongocxx/test/options/update.cpp index 2e6482e4d0..7c59da3cf5 100644 --- a/src/mongocxx/test/options/update.cpp +++ b/src/mongocxx/test/options/update.cpp @@ -13,9 +13,11 @@ // limitations under the License. #include -#include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/pool.cpp b/src/mongocxx/test/pool.cpp index 9a87c76467..4966e7b983 100644 --- a/src/mongocxx/test/pool.cpp +++ b/src/mongocxx/test/pool.cpp @@ -15,17 +15,19 @@ #include #include -#include #include #include #include #include #include #include -#include #include +#include + +#include + namespace { using namespace mongocxx; diff --git a/src/mongocxx/test/private/numeric_casting.cpp b/src/mongocxx/test/private/numeric_casting.cpp index c0af6b6198..f803f767be 100644 --- a/src/mongocxx/test/private/numeric_casting.cpp +++ b/src/mongocxx/test/private/numeric_casting.cpp @@ -13,10 +13,11 @@ // limitations under the License. #include -#include #include #include +#include + namespace { TEST_CASE("can do basic numeric_casting", "[numeric_casting]") { diff --git a/src/mongocxx/test/private/scoped_bson_t.cpp b/src/mongocxx/test/private/scoped_bson_t.cpp index 9118915f86..605770636f 100644 --- a/src/mongocxx/test/private/scoped_bson_t.cpp +++ b/src/mongocxx/test/private/scoped_bson_t.cpp @@ -15,9 +15,10 @@ #include #include #include -#include #include +#include + namespace { using namespace bsoncxx; using namespace mongocxx; diff --git a/src/mongocxx/test/private/write_concern.cpp b/src/mongocxx/test/private/write_concern.cpp index 24fd484c65..1114a3d69c 100644 --- a/src/mongocxx/test/private/write_concern.cpp +++ b/src/mongocxx/test/private/write_concern.cpp @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include #include #include #include +#include + namespace { using namespace mongocxx; diff --git a/src/mongocxx/test/read_concern.cpp b/src/mongocxx/test/read_concern.cpp index 207053a80c..2e8292bbcd 100644 --- a/src/mongocxx/test/read_concern.cpp +++ b/src/mongocxx/test/read_concern.cpp @@ -13,10 +13,11 @@ // limitations under the License. #include -#include #include #include +#include + namespace { using namespace mongocxx; diff --git a/src/mongocxx/test/read_preference.cpp b/src/mongocxx/test/read_preference.cpp index bbaed6b4fe..0f23d78943 100644 --- a/src/mongocxx/test/read_preference.cpp +++ b/src/mongocxx/test/read_preference.cpp @@ -15,11 +15,13 @@ #include #include #include -#include #include #include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/result/bulk_write.cpp b/src/mongocxx/test/result/bulk_write.cpp index ced15d8747..39f9ecd287 100644 --- a/src/mongocxx/test/result/bulk_write.cpp +++ b/src/mongocxx/test/result/bulk_write.cpp @@ -14,11 +14,12 @@ #include #include -#include #include #include #include +#include + namespace { using namespace bsoncxx; diff --git a/src/mongocxx/test/result/delete.cpp b/src/mongocxx/test/result/delete.cpp index 9a3cb67393..ef7e8db204 100644 --- a/src/mongocxx/test/result/delete.cpp +++ b/src/mongocxx/test/result/delete.cpp @@ -14,10 +14,11 @@ #include #include -#include #include #include +#include + namespace { using bsoncxx::builder::basic::kvp; diff --git a/src/mongocxx/test/result/gridfs/upload.cpp b/src/mongocxx/test/result/gridfs/upload.cpp index 96192f597d..fd7cb2169d 100644 --- a/src/mongocxx/test/result/gridfs/upload.cpp +++ b/src/mongocxx/test/result/gridfs/upload.cpp @@ -16,12 +16,13 @@ #include #include #include -#include #include #include #include #include +#include + namespace { using namespace bsoncxx; using namespace mongocxx; diff --git a/src/mongocxx/test/result/insert_one.cpp b/src/mongocxx/test/result/insert_one.cpp index 9e95356614..5d19b927c6 100644 --- a/src/mongocxx/test/result/insert_one.cpp +++ b/src/mongocxx/test/result/insert_one.cpp @@ -13,11 +13,12 @@ // limitations under the License. #include -#include #include #include #include +#include + namespace { using namespace bsoncxx; diff --git a/src/mongocxx/test/result/replace_one.cpp b/src/mongocxx/test/result/replace_one.cpp index 849bf49bfb..4547495ff0 100644 --- a/src/mongocxx/test/result/replace_one.cpp +++ b/src/mongocxx/test/result/replace_one.cpp @@ -13,10 +13,11 @@ // limitations under the License. #include -#include #include #include +#include + namespace { using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_document; diff --git a/src/mongocxx/test/result/update.cpp b/src/mongocxx/test/result/update.cpp index c68bf9ff7a..a58167b9df 100644 --- a/src/mongocxx/test/result/update.cpp +++ b/src/mongocxx/test/result/update.cpp @@ -13,10 +13,11 @@ // limitations under the License. #include -#include #include #include +#include + namespace { using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_document; diff --git a/src/mongocxx/test/sdam-monitoring.cpp b/src/mongocxx/test/sdam-monitoring.cpp index 50fc4ef500..5a09f6b03c 100644 --- a/src/mongocxx/test/sdam-monitoring.cpp +++ b/src/mongocxx/test/sdam-monitoring.cpp @@ -16,11 +16,12 @@ #include #include -#include -#include #include #include #include + +#include +#include #include #include diff --git a/src/mongocxx/test/search_index_view.cpp b/src/mongocxx/test/search_index_view.cpp index 15c81c4377..aabaed70f9 100644 --- a/src/mongocxx/test/search_index_view.cpp +++ b/src/mongocxx/test/search_index_view.cpp @@ -4,11 +4,12 @@ #include #include #include -#include #include #include #include #include + +#include #include namespace { diff --git a/src/mongocxx/test/spec/client_side_encryption.cpp b/src/mongocxx/test/spec/client_side_encryption.cpp index 4ec72477ca..cabcae0660 100644 --- a/src/mongocxx/test/spec/client_side_encryption.cpp +++ b/src/mongocxx/test/spec/client_side_encryption.cpp @@ -16,10 +16,11 @@ #include #include -#include #include #include #include + +#include #include #include #include diff --git a/src/mongocxx/test/spec/command_monitoring.cpp b/src/mongocxx/test/spec/command_monitoring.cpp index d82f13388d..ec076b562a 100644 --- a/src/mongocxx/test/spec/command_monitoring.cpp +++ b/src/mongocxx/test/spec/command_monitoring.cpp @@ -16,11 +16,12 @@ #include #include -#include -#include #include #include #include + +#include +#include #include #include #include diff --git a/src/mongocxx/test/spec/crud.cpp b/src/mongocxx/test/spec/crud.cpp index f0ef54f83d..c7c6f56dce 100644 --- a/src/mongocxx/test/spec/crud.cpp +++ b/src/mongocxx/test/spec/crud.cpp @@ -14,8 +14,9 @@ #include -#include #include + +#include #include namespace { diff --git a/src/mongocxx/test/spec/gridfs.cpp b/src/mongocxx/test/spec/gridfs.cpp index 4ae2f60aa2..5e15b715a4 100644 --- a/src/mongocxx/test/spec/gridfs.cpp +++ b/src/mongocxx/test/spec/gridfs.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -40,6 +39,8 @@ #include #include #include + +#include #include #include diff --git a/src/mongocxx/test/spec/initial_dns_seedlist_discovery.cpp b/src/mongocxx/test/spec/initial_dns_seedlist_discovery.cpp index a2862e2415..a79c234349 100644 --- a/src/mongocxx/test/spec/initial_dns_seedlist_discovery.cpp +++ b/src/mongocxx/test/spec/initial_dns_seedlist_discovery.cpp @@ -17,11 +17,12 @@ #include #include -#include #include #include #include #include + +#include #include namespace { diff --git a/src/mongocxx/test/spec/mongohouse.cpp b/src/mongocxx/test/spec/mongohouse.cpp index c8b13fec1a..a7a37ae6e4 100644 --- a/src/mongocxx/test/spec/mongohouse.cpp +++ b/src/mongocxx/test/spec/mongohouse.cpp @@ -15,11 +15,12 @@ #include #include #include -#include #include #include #include #include + +#include #include #include #include diff --git a/src/mongocxx/test/spec/monitoring.cpp b/src/mongocxx/test/spec/monitoring.cpp index e2d0370a28..f5ceaab3de 100644 --- a/src/mongocxx/test/spec/monitoring.cpp +++ b/src/mongocxx/test/spec/monitoring.cpp @@ -17,15 +17,16 @@ #include #include +#include + +#include + #include #include -#include #include #include #include -#include - namespace mongocxx { namespace spec { diff --git a/src/mongocxx/test/spec/monitoring.hh b/src/mongocxx/test/spec/monitoring.hh index 1d3e0687d2..b560216a10 100644 --- a/src/mongocxx/test/spec/monitoring.hh +++ b/src/mongocxx/test/spec/monitoring.hh @@ -15,11 +15,12 @@ #pragma once #include -#include -#include #include +#include +#include + namespace mongocxx { namespace spec { diff --git a/src/mongocxx/test/spec/operation.cpp b/src/mongocxx/test/spec/operation.cpp index e10d0a1f47..20e56b94f4 100644 --- a/src/mongocxx/test/spec/operation.cpp +++ b/src/mongocxx/test/spec/operation.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -40,10 +39,12 @@ #include #include #include -#include #include +#include +#include + namespace mongocxx { namespace spec { diff --git a/src/mongocxx/test/spec/read_write_concern.cpp b/src/mongocxx/test/spec/read_write_concern.cpp index 65be27b3db..a7b2753db9 100644 --- a/src/mongocxx/test/spec/read_write_concern.cpp +++ b/src/mongocxx/test/spec/read_write_concern.cpp @@ -12,8 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include + +#include #include namespace { diff --git a/src/mongocxx/test/spec/retryable-reads.cpp b/src/mongocxx/test/spec/retryable-reads.cpp index 2bef0a6c40..40578dfb7f 100644 --- a/src/mongocxx/test/spec/retryable-reads.cpp +++ b/src/mongocxx/test/spec/retryable-reads.cpp @@ -16,9 +16,10 @@ #include #include -#include #include #include + +#include #include #include #include diff --git a/src/mongocxx/test/spec/transactions.cpp b/src/mongocxx/test/spec/transactions.cpp index 17af2698d3..3909a2fb80 100644 --- a/src/mongocxx/test/spec/transactions.cpp +++ b/src/mongocxx/test/spec/transactions.cpp @@ -12,8 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include + +#include #include namespace { diff --git a/src/mongocxx/test/spec/unified_tests/assert.cpp b/src/mongocxx/test/spec/unified_tests/assert.cpp index 62223ab4b3..6ce84b58f1 100644 --- a/src/mongocxx/test/spec/unified_tests/assert.cpp +++ b/src/mongocxx/test/spec/unified_tests/assert.cpp @@ -21,10 +21,11 @@ #include #include -#include -#include #include #include + +#include +#include #include using namespace bsoncxx; diff --git a/src/mongocxx/test/spec/unified_tests/assert.hh b/src/mongocxx/test/spec/unified_tests/assert.hh index 0df047926d..de501928cd 100644 --- a/src/mongocxx/test/spec/unified_tests/assert.hh +++ b/src/mongocxx/test/spec/unified_tests/assert.hh @@ -15,6 +15,7 @@ #pragma once #include "entity.hh" + #include #include diff --git a/src/mongocxx/test/spec/unified_tests/operations.cpp b/src/mongocxx/test/spec/unified_tests/operations.cpp index cd5df41881..89309d7935 100644 --- a/src/mongocxx/test/spec/unified_tests/operations.cpp +++ b/src/mongocxx/test/spec/unified_tests/operations.cpp @@ -20,14 +20,15 @@ #include #include #include -#include #include #include #include -#include #include +#include +#include + namespace mongocxx { using namespace bsoncxx; diff --git a/src/mongocxx/test/spec/unified_tests/operations.hh b/src/mongocxx/test/spec/unified_tests/operations.hh index 4f5dc01663..46df6b5f16 100644 --- a/src/mongocxx/test/spec/unified_tests/operations.hh +++ b/src/mongocxx/test/spec/unified_tests/operations.hh @@ -14,16 +14,18 @@ #pragma once +#include "entity.hh" + #include -#include "entity.hh" #include #include #include -#include #include +#include + namespace mongocxx { namespace operations { diff --git a/src/mongocxx/test/spec/unified_tests/runner.cpp b/src/mongocxx/test/spec/unified_tests/runner.cpp index 38a4767496..aa32df8432 100644 --- a/src/mongocxx/test/spec/unified_tests/runner.cpp +++ b/src/mongocxx/test/spec/unified_tests/runner.cpp @@ -12,27 +12,29 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "assert.hh" +#include "entity.hh" +#include "operations.hh" + #include #include #include #include #include -#include "assert.hh" -#include "entity.hh" -#include "operations.hh" #include #include #include #include #include -#include #include #include #include #include #include #include + +#include #include #include #include diff --git a/src/mongocxx/test/spec/uri_options.cpp b/src/mongocxx/test/spec/uri_options.cpp index 8adea2430a..c3f1e7e9b4 100644 --- a/src/mongocxx/test/spec/uri_options.cpp +++ b/src/mongocxx/test/spec/uri_options.cpp @@ -15,11 +15,12 @@ #include #include -#include #include #include #include +#include + namespace { struct URIOptionsTest { diff --git a/src/mongocxx/test/spec/util.cpp b/src/mongocxx/test/spec/util.cpp index 1cbeda2d36..68cf5fdece 100644 --- a/src/mongocxx/test/spec/util.cpp +++ b/src/mongocxx/test/spec/util.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -38,12 +37,14 @@ #include #include #include + +#include + +#include #include #include #include -#include - namespace mongocxx { namespace spec { diff --git a/src/mongocxx/test/spec/util.hh b/src/mongocxx/test/spec/util.hh index c23840d64b..5fbfaf236b 100644 --- a/src/mongocxx/test/spec/util.hh +++ b/src/mongocxx/test/spec/util.hh @@ -19,11 +19,12 @@ #include #include -#include #include #include +#include + namespace mongocxx { namespace spec { diff --git a/src/mongocxx/test/transactions.cpp b/src/mongocxx/test/transactions.cpp index a890270263..eb531a53b1 100644 --- a/src/mongocxx/test/transactions.cpp +++ b/src/mongocxx/test/transactions.cpp @@ -15,11 +15,12 @@ #include #include -#include #include #include #include #include + +#include #include namespace { diff --git a/src/mongocxx/test/uri.cpp b/src/mongocxx/test/uri.cpp index 5367cb3ff9..d8fd5da99f 100644 --- a/src/mongocxx/test/uri.cpp +++ b/src/mongocxx/test/uri.cpp @@ -18,11 +18,12 @@ #include #include #include -#include #include #include #include +#include + namespace { TEST_CASE("URI", "[uri]") { SECTION("Default URI") { diff --git a/src/mongocxx/test/validation_criteria.cpp b/src/mongocxx/test/validation_criteria.cpp index 4ab3bc3e9c..c352bf73d2 100644 --- a/src/mongocxx/test/validation_criteria.cpp +++ b/src/mongocxx/test/validation_criteria.cpp @@ -15,9 +15,11 @@ #include #include #include -#include #include #include + +#include + #include namespace { diff --git a/src/mongocxx/test/versioned_api.cpp b/src/mongocxx/test/versioned_api.cpp index 7ad60f2fc2..2276b088c4 100644 --- a/src/mongocxx/test/versioned_api.cpp +++ b/src/mongocxx/test/versioned_api.cpp @@ -13,15 +13,16 @@ // limitations under the License. #include -#include #include #include #include #include #include -#include #include +#include +#include + using namespace mongocxx; static bool has_api_version_1( diff --git a/src/mongocxx/test/write_concern.cpp b/src/mongocxx/test/write_concern.cpp index e5478d1705..0820ba1cf7 100644 --- a/src/mongocxx/test/write_concern.cpp +++ b/src/mongocxx/test/write_concern.cpp @@ -14,12 +14,13 @@ #include #include -#include #include #include #include #include +#include + namespace { using namespace mongocxx; From 81907fa5ea28d5a5721385f49b00dd474a8bed65 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 28 Aug 2024 14:11:10 -0500 Subject: [PATCH 02/13] Remove obsolete MONGO_CXX_DRIVER_COMPILING compile definition --- src/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7f158f3d1b..1ecf5a2761 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_definitions(-DMONGO_CXX_DRIVER_COMPILING) add_subdirectory(bsoncxx) add_subdirectory(mongocxx) From a3c95488ec8db53d05f70899903a9993a7808e1d Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 28 Aug 2024 14:11:10 -0500 Subject: [PATCH 03/13] Do not build or run tests on VS 2015 distros --- .mci.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.mci.yml b/.mci.yml index 370d049d8d..4f94da4431 100644 --- a/.mci.yml +++ b/.mci.yml @@ -1001,6 +1001,8 @@ tasks: - func: "setup" - func: "fetch_c_driver_source" - func: "compile" + vars: + ENABLE_TESTS: OFF - command: shell.exec type: test params: @@ -1015,6 +1017,8 @@ tasks: - func: "setup" - func: "fetch_c_driver_source" - func: "compile" + vars: + ENABLE_TESTS: OFF - command: shell.exec type: test params: @@ -2156,10 +2160,7 @@ buildvariants: run_on: - windows-64-vs2015-compile tasks: - - name: compile_and_test_with_shared_libs - - name: compile_and_test_with_shared_libs_extra_alignment - - name: compile_and_test_with_static_libs - - name: compile_and_test_with_static_libs_extra_alignment + - name: compile_without_tests - name: uninstall_check_windows - name: windows-2k8-debug @@ -2172,9 +2173,8 @@ buildvariants: run_on: - windows-64-vs2015-compile tasks: - # The debug shared lib is tested in the "integration tests" matrix - - name: compile_and_test_with_static_libs - - name: compile_and_test_with_static_libs_extra_alignment + - name: compile_without_tests + - name: uninstall_check_windows - name: windows-msvc2015-debug display_name: "Windows (VS 2015) Debug (MongoDB 4.2)" @@ -2186,8 +2186,8 @@ buildvariants: run_on: - windows-64-vs2015-compile tasks: - - name: compile_with_shared_libs - - name: compile_and_test_auth_with_shared_libs + - name: compile_without_tests + - name: uninstall_check_windows - name: packaging display_name: Linux Distro Packaging From afb5804e3199b04b6090612142867ebfabd70fe1 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 28 Aug 2024 14:11:10 -0500 Subject: [PATCH 04/13] Upgrade to Catch2 v3 via FetchCatch2.cmake --- .evergreen/test.sh | 1 + CHANGELOG.md | 4 +- cmake/CMakeLists.txt | 1 + cmake/FetchCatch2.cmake | 39 + src/CMakeLists.txt | 3 - src/bsoncxx/test/CMakeLists.txt | 15 +- src/bsoncxx/test/bson_builder.cpp | 11 +- src/bsoncxx/test/bson_types.cpp | 36 +- src/bsoncxx/test/catch.hh | 11 +- src/bsoncxx/test/exception_guard.cpp | 8 +- src/mongocxx/test/CMakeLists.txt | 16 +- .../test/catch_helpers.hh} | 11 +- src/mongocxx/test/change_streams.cpp | 3 +- src/mongocxx/test/client.cpp | 3 +- src/mongocxx/test/client_session.cpp | 5 +- src/mongocxx/test/client_side_encryption.cpp | 56 +- src/mongocxx/test/collection_mocked.cpp | 3 +- src/mongocxx/test/database.cpp | 5 +- src/mongocxx/test/index_view.cpp | 5 +- src/mongocxx/test/model/delete_many.cpp | 3 +- src/mongocxx/test/model/delete_one.cpp | 3 +- src/mongocxx/test/model/replace_one.cpp | 3 +- src/mongocxx/test/model/update_many.cpp | 3 +- src/mongocxx/test/model/update_one.cpp | 3 +- src/mongocxx/test/options/aggregate.cpp | 3 +- src/mongocxx/test/options/bulk_write.cpp | 3 +- src/mongocxx/test/options/count.cpp | 3 +- .../test/options/create_collection.cpp | 3 +- src/mongocxx/test/options/delete.cpp | 3 +- src/mongocxx/test/options/distinct.cpp | 3 +- src/mongocxx/test/options/find.cpp | 3 +- .../test/options/find_one_and_delete.cpp | 3 +- .../test/options/find_one_and_replace.cpp | 3 +- .../test/options/find_one_and_update.cpp | 3 +- src/mongocxx/test/options/gridfs/bucket.cpp | 3 +- src/mongocxx/test/options/gridfs/upload.cpp | 3 +- src/mongocxx/test/options/index.cpp | 3 +- src/mongocxx/test/options/insert.cpp | 3 +- src/mongocxx/test/options/replace.cpp | 3 +- src/mongocxx/test/options/update.cpp | 3 +- src/mongocxx/test/pool.cpp | 3 +- src/mongocxx/test/read_preference.cpp | 3 +- src/mongocxx/test/search_index_view.cpp | 5 +- src/mongocxx/test/spec/util.cpp | 6 +- src/mongocxx/test/validation_criteria.cpp | 3 +- src/mongocxx/test/versioned_api.cpp | 4 +- src/third_party/catch/include/catch.hpp | 17959 ---------------- src/third_party/catch/main.cpp | 16 - 48 files changed, 192 insertions(+), 18106 deletions(-) create mode 100644 cmake/FetchCatch2.cmake rename src/{third_party/catch/include/helpers.hpp => mongocxx/test/catch_helpers.hh} (98%) delete mode 100644 src/third_party/catch/include/catch.hpp delete mode 100644 src/third_party/catch/main.cpp diff --git a/.evergreen/test.sh b/.evergreen/test.sh index 8b7ef77ffe..ec99f0d385 100755 --- a/.evergreen/test.sh +++ b/.evergreen/test.sh @@ -60,6 +60,7 @@ PATH="${working_dir:?}/build/src/mongocxx/test/${build_type:?}:${PATH:-}" PATH="${working_dir:?}/build/src/bsoncxx/test/${build_type:?}:${PATH:-}" PATH="${working_dir:?}/build/src/mongocxx/${build_type:?}:${PATH:-}" PATH="${working_dir:?}/build/src/bsoncxx/${build_type:?}:${PATH:-}" +PATH="${working_dir:?}/build/_deps/ep_catch2-build/src/${build_type:?}:${PATH:-}" PATH="${mongoc_dir:?}/bin:${PATH:-}" PATH="${working_dir:?}/build/install/bin:${PATH:-}" diff --git a/CHANGELOG.md b/CHANGELOG.md index 39611d7618..2e42fa9cc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,8 +11,10 @@ Changes prior to 3.9.0 are documented as [release notes on GitHub](https://githu ### Changed -- `FetchContent_MakeAvailable()` is used to populate dependencies instead of `FetchContent_Populate()` for the Mongo C Driver (when not provided by `CMAKE_PREFIX_PATH`) and mnmlstc/core (when automatically selected or `BSONCXX_POLY_USE_MNMLSTC=ON`). +- `FetchContent_MakeAvailable()` is used to populate dependencies instead of `FetchContent_Populate()` for the Mongo C Driver (when not provided by `CMAKE_PREFIX_PATH`) and mnmlstc/core (when automatically selected or when `BSONCXX_POLY_USE_MNMLSTC=ON`). - Note: `FetchContent_Populate()` is still used for mnmlstc/core for CMake versions prior to 3.18 to avoid `add_subdirectory()` behavior. +- Test suite now uses Catch2 v3 via FetchContent instead of the bundled Catch2 v2 standalone header. + - C++14 or newer is now required to build tests when enabled with `ENABLE_TESTS=ON`. ### Deprecated diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index b7ff0fc481..5078db9a77 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -16,6 +16,7 @@ add_subdirectory(make_dist) set(cmake_MODULES BsoncxxUtil.cmake + FetchCatch2.cmake FetchMnmlstcCore.cmake FetchMongoC.cmake MacroGuardTest.cmake diff --git a/cmake/FetchCatch2.cmake b/cmake/FetchCatch2.cmake new file mode 100644 index 0000000000..704e02bb40 --- /dev/null +++ b/cmake/FetchCatch2.cmake @@ -0,0 +1,39 @@ +# Use FetchContent to obtain Catch2. + +include(FetchContent) + +message(STATUS "Downloading Catch2...") + +function(fetch_catch2) + FetchContent_Declare( + EP_Catch2 + + GIT_REPOSITORY https://github.com/catchorg/Catch2 + GIT_TAG v3.7.0 + GIT_SHALLOW TRUE + LOG_DOWNLOAD ON + + FETCHCONTENT_UPDATES_DISCONNECTED ON + ) + + FetchContent_GetProperties(EP_Catch2) + + if(NOT ep_catch2_POPULATED) + # Avoid Catch2 compile warnings from being treated as errors. + string(REPLACE "-Werror" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + string(REPLACE "-Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + + FetchContent_MakeAvailable(EP_Catch2) + + # Avoid building unnecessary targets. Use FetchContent_Declare(EXCLUDE_FROM_ALL) in CMake 3.28 and newer. + set_property(DIRECTORY "${ep_catch2_SOURCE_DIR}" PROPERTY EXCLUDE_FROM_ALL ON) + + # Catch2 config vars. + set_property(CACHE CATCH_INSTALL_DOCS PROPERTY VALUE OFF) + set_property(CACHE CATCH_INSTALL_EXTRAS PROPERTY VALUE OFF) + endif() +endfunction() + +fetch_catch2() + +message (STATUS "Downloading Catch2... done.") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1ecf5a2761..c42504620a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,9 +17,6 @@ add_subdirectory(mongocxx) set_local_dist(src_DIST_local CMakeLists.txt - third_party/catch/main.cpp - third_party/catch/include/catch.hpp - third_party/catch/include/helpers.hpp ) set(src_DIST diff --git a/src/bsoncxx/test/CMakeLists.txt b/src/bsoncxx/test/CMakeLists.txt index 2b7a6482b8..603c25e665 100644 --- a/src/bsoncxx/test/CMakeLists.txt +++ b/src/bsoncxx/test/CMakeLists.txt @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +include(FetchCatch2) + if(NOT BUILD_TESTING) set_property(DIRECTORY PROPERTY EXCLUDE_FROM_ALL TRUE) endif() @@ -46,25 +48,28 @@ add_executable(test_bson # Common target properties for test executables. add_library(bsoncxx_test_properties INTERFACE) + +target_link_libraries(bsoncxx_test_properties INTERFACE Catch2::Catch2) +target_compile_features(bsoncxx_test_properties INTERFACE cxx_std_14) + target_link_libraries(bsoncxx_test_properties INTERFACE bsoncxx_testing ${libbson_target}) target_include_directories(bsoncxx_test_properties INTERFACE # Allow `#include ` ${libbson_include_directories} - # Allow `#include ` and `#include `. + # Allow `#include `. ${CMAKE_CURRENT_SOURCE_DIR}/../.. ) target_compile_definitions(bsoncxx_test_properties INTERFACE ${libbson_definitions}) add_library(bsoncxx::test_properties ALIAS bsoncxx_test_properties) # Avoid redundant recompilation of catch/main.cpp. -add_library(bsoncxx_test_properties_with_main STATIC EXCLUDE_FROM_ALL ${THIRD_PARTY_SOURCE_DIR}/catch/main.cpp) -target_link_libraries(bsoncxx_test_properties_with_main PUBLIC bsoncxx::test_properties) +add_library(bsoncxx_test_properties_with_main INTERFACE) +target_link_libraries(bsoncxx_test_properties_with_main INTERFACE bsoncxx::test_properties Catch2::Catch2WithMain) add_library(bsoncxx::test_properties_with_main ALIAS bsoncxx_test_properties_with_main) -set_property(TARGET test_bson APPEND PROPERTY LINK_LIBRARIES bsoncxx::test_properties_with_main) - +target_link_libraries (test_bson PRIVATE bsoncxx::test_properties_with_main) add_test(NAME bson COMMAND test_bson) # Generate test to ensure macro guards behave properly. diff --git a/src/bsoncxx/test/bson_builder.cpp b/src/bsoncxx/test/bson_builder.cpp index f94fe1ce46..f43b7c806a 100644 --- a/src/bsoncxx/test/bson_builder.cpp +++ b/src/bsoncxx/test/bson_builder.cpp @@ -29,6 +29,9 @@ #include +#include +#include + namespace { using namespace bsoncxx; @@ -1712,12 +1715,12 @@ TEST_CASE("list builder with explicit type deduction", "[bsoncxx::builder::list] SECTION("document") { builder::list b; - auto kvp_regex = - Catch::Matches("(.*)must be list of key-value pairs(.*)", Catch::CaseSensitive::No); + auto kvp_regex = Catch::Matchers::Matches("(.*)must be list of key-value pairs(.*)", + Catch::CaseSensitive::No); REQUIRE_THROWS_WITH((b = builder::document{"foo", 1, 2}), kvp_regex); - auto type_regex = - Catch::Matches("(.*)must be string type(.*)int32(.*)", Catch::CaseSensitive::No); + auto type_regex = Catch::Matchers::Matches("(.*)must be string type(.*)int32(.*)", + Catch::CaseSensitive::No); REQUIRE_THROWS_WITH((b = builder::document{"foo", 1, 2, 4}), type_regex); } } diff --git a/src/bsoncxx/test/bson_types.cpp b/src/bsoncxx/test/bson_types.cpp index 2cb81d9f60..f791409d6b 100644 --- a/src/bsoncxx/test/bson_types.cpp +++ b/src/bsoncxx/test/bson_types.cpp @@ -23,6 +23,8 @@ #include +#include + namespace { using namespace bsoncxx; @@ -154,7 +156,7 @@ TEST_CASE("b_int32", "[bsoncxx::type::b_int32]") { REQUIRE(!(a == c)); } -TEST_CASE("b_timestamp", "[bsoncxx::type::b_timestamp") { +TEST_CASE("b_timestamp", "[bsoncxx::type::b_timestamp]") { b_timestamp a{100, 1000}; b_timestamp b{100, 1000}; b_timestamp c{200, 1000}; @@ -374,22 +376,25 @@ TEST_CASE("document uninitialized element throws exceptions", "") { bsoncxx::document::value doc = make_document(kvp("foo", "bar")); REQUIRE_THROWS_WITH(doc["doesnotexist"].get_string().value, - Catch::Contains("cannot get string from an uninitialized element with key " - "\"doesnotexist\": unset document::element")); + + Catch::Matchers::ContainsSubstring( + "cannot get string from an uninitialized element with key " + "\"doesnotexist\": unset document::element")); REQUIRE_THROWS_WITH(doc["alsodoesnotexist"].get_value(), - Catch::Contains("cannot return the type of uninitialized element with key " - "\"alsodoesnotexist\": unset document::element")); + Catch::Matchers::ContainsSubstring( + "cannot return the type of uninitialized element with key " + "\"alsodoesnotexist\": unset document::element")); // Ensure a non-existing element evaluates to false. REQUIRE(!doc["doesnotexist"]); // Ensure finding a non-existing element results in an end iterator. REQUIRE(doc.find("doesnotexist") == doc.cend()); // Ensure getting a key from a non-existing element results in an exception. - REQUIRE_THROWS_WITH( - doc["doesnotexist"].key(), - Catch::Contains("cannot return the key from an uninitialized element with key " - "\"doesnotexist\": unset document::element")); + REQUIRE_THROWS_WITH(doc["doesnotexist"].key(), + Catch::Matchers::ContainsSubstring( + "cannot return the key from an uninitialized element with key " + "\"doesnotexist\": unset document::element")); } TEST_CASE("array uninitialized element throws exceptions", "") { @@ -398,16 +403,17 @@ TEST_CASE("array uninitialized element throws exceptions", "") { bsoncxx::array::value arr = make_array("a", "b", "c"); REQUIRE_THROWS_WITH(arr.view()[3].get_string().value, - Catch::Contains("cannot get string from an uninitialized element with key " - "\"3\": unset document::element")); + Catch::Matchers::ContainsSubstring( + "cannot get string from an uninitialized element with key " + "\"3\": unset document::element")); // Ensure a non-existing element evaluates to false. REQUIRE(!arr.view()[3]); // Ensure finding a non-existing element results in an end iterator. REQUIRE(arr.view().find(3) == arr.view().cend()); // Ensure getting a key from a non-existing element results in an exception. - REQUIRE_THROWS_WITH( - arr.view()[3].key(), - Catch::Contains("cannot return the key from an uninitialized element with key " - "\"3\": unset document::element")); + REQUIRE_THROWS_WITH(arr.view()[3].key(), + Catch::Matchers::ContainsSubstring( + "cannot return the key from an uninitialized element with key " + "\"3\": unset document::element")); } } // namespace diff --git a/src/bsoncxx/test/catch.hh b/src/bsoncxx/test/catch.hh index 34ef57ae0c..cba3f7f20c 100644 --- a/src/bsoncxx/test/catch.hh +++ b/src/bsoncxx/test/catch.hh @@ -24,10 +24,10 @@ #include -#include +#include // TEST_CASE, SECTION, CHECK, etc. +#include // Catch::StringMaker namespace Catch { -using namespace bsoncxx; // Catch2 must be able to stringify documents, optionals, etc. if they're used in Catch2 macros. @@ -41,7 +41,7 @@ struct StringMaker { template <> struct StringMaker { static std::string convert(const bsoncxx::document::view& value) { - return bsoncxx::to_json(value, ExtendedJsonMode::k_relaxed); + return bsoncxx::to_json(value, bsoncxx::ExtendedJsonMode::k_relaxed); } }; @@ -62,6 +62,7 @@ struct StringMaker { template <> struct StringMaker { static std::string convert(const bsoncxx::types::bson_value::view& value) { + using bsoncxx::to_string; return '{' + to_string(value.type()) + ": " + to_string(value) + '}'; } }; @@ -81,7 +82,7 @@ struct StringMaker { }; template -struct StringMaker> { +struct StringMaker> { static std::string convert(const bsoncxx::stdx::optional& value) { if (value) { return StringMaker::convert(value.value()); @@ -92,7 +93,7 @@ struct StringMaker> { }; template <> -struct StringMaker> { +struct StringMaker> { static std::string convert(const bsoncxx::stdx::optional&) { return "{nullopt}"; } diff --git a/src/bsoncxx/test/exception_guard.cpp b/src/bsoncxx/test/exception_guard.cpp index 8fe299fa2d..a1138d97ae 100644 --- a/src/bsoncxx/test/exception_guard.cpp +++ b/src/bsoncxx/test/exception_guard.cpp @@ -25,6 +25,8 @@ #include +#include + namespace { TEST_CASE("bsoncxx::test::exception_guard", "[test]") { @@ -126,7 +128,7 @@ TEST_CASE("bsoncxx::test::exception_guard", "[test]") { CAPTURE(expected.line); CAPTURE(expected.func); - CHECK_THAT(log, Catch::Contains("two")); + CHECK_THAT(log, Catch::Matchers::ContainsSubstring("two")); CHECK(log_view.find(expected.file) != npos); CHECK(log_view.find(std::to_string(expected.line)) != npos); CHECK(log_view.find(expected.func) == npos); // Func is not logged. @@ -148,7 +150,7 @@ TEST_CASE("bsoncxx::test::exception_guard", "[test]") { CAPTURE(expected.line); CAPTURE(expected.func); - CHECK_THAT(log, Catch::Contains("Catch::TestFailureException")); + CHECK_THAT(log, Catch::Matchers::ContainsSubstring("Catch::TestFailureException")); CHECK(log_view.find(expected.file) != npos); CHECK(log_view.find(std::to_string(expected.line)) != npos); CHECK(log_view.find(expected.func) == npos); // Func is not logged. @@ -156,7 +158,7 @@ TEST_CASE("bsoncxx::test::exception_guard", "[test]") { // The original exception. const auto check_expr = [&] { BSONCXX_TEST_EXCEPTION_GUARD_CHECK(eguard); }; - REQUIRE_THROWS_WITH(check_expr(), Catch::Contains("one")); + REQUIRE_THROWS_WITH(check_expr(), Catch::Matchers::ContainsSubstring("one")); } } diff --git a/src/mongocxx/test/CMakeLists.txt b/src/mongocxx/test/CMakeLists.txt index 4bf8e8eb12..a51bf26645 100644 --- a/src/mongocxx/test/CMakeLists.txt +++ b/src/mongocxx/test/CMakeLists.txt @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +include(FetchCatch2) + if(NOT BUILD_TESTING) set_property(DIRECTORY PROPERTY EXCLUDE_FROM_ALL TRUE) endif() @@ -174,20 +176,23 @@ add_executable(test_versioned_api # Common target properties for test executables. add_library(mongocxx_test_properties INTERFACE) -target_link_libraries(mongocxx_test_properties INTERFACE mongocxx_mocked ${libmongoc_target}) + +target_link_libraries(mongocxx_test_properties INTERFACE Catch2::Catch2) +target_compile_features(mongocxx_test_properties INTERFACE cxx_std_14) + +target_link_libraries(mongocxx_test_properties INTERFACE mongocxx_mocked ${libmongoc_target} Catch2::Catch2) target_include_directories(mongocxx_test_properties INTERFACE # Allow `#include ` ${libmongoc_include_directories} - # Allow `#include ` and `#include `. + # Allow `#include `. ${CMAKE_CURRENT_SOURCE_DIR}/../.. ) add_library(mongocxx::test_properties ALIAS mongocxx_test_properties) -# Avoid redundant recompilation of catch/main.cpp. -add_library(mongocxx_test_properties_with_main STATIC EXCLUDE_FROM_ALL ${THIRD_PARTY_SOURCE_DIR}/catch/main.cpp) -target_link_libraries(mongocxx_test_properties_with_main PUBLIC mongocxx::test_properties) +add_library(mongocxx_test_properties_with_main INTERFACE) +target_link_libraries(mongocxx_test_properties_with_main INTERFACE mongocxx::test_properties Catch2::Catch2WithMain) add_library(mongocxx::test_properties_with_main ALIAS mongocxx_test_properties_with_main) set_property( @@ -341,6 +346,7 @@ endif() set_dist_list(src_mongocxx_test_DIST CMakeLists.txt bulk_write.cpp + catch_helpers.hh change_streams.cpp client_helpers.cpp client_helpers.hh diff --git a/src/third_party/catch/include/helpers.hpp b/src/mongocxx/test/catch_helpers.hh similarity index 98% rename from src/third_party/catch/include/helpers.hpp rename to src/mongocxx/test/catch_helpers.hh index 56ab27df33..5d9e791de2 100644 --- a/src/third_party/catch/include/helpers.hpp +++ b/src/mongocxx/test/catch_helpers.hh @@ -14,25 +14,30 @@ #pragma once -#include #include #include #include +#include + +#include +#include +#include + namespace mongocxx { namespace test_util { // Check that an error message includes a substring, case-insensitively. Use like: // REQUIRE_THROWS_MATCHES(function(), mongocxx::exception, mongocxx_exception_matcher("substring") -class mongocxx_exception_matcher : public Catch::MatcherBase { +class mongocxx_exception_matcher : public Catch::Matchers::MatcherBase { std::string expected_msg; public: mongocxx_exception_matcher(std::string msg) : expected_msg(msg) {} bool match(const mongocxx::exception& exc) const override { - return Catch::Contains(expected_msg, Catch::CaseSensitive::No).match(exc.what()); + return Catch::Matchers::ContainsSubstring(expected_msg, Catch::CaseSensitive::No).match(exc.what()); } std::string describe() const override { diff --git a/src/mongocxx/test/change_streams.cpp b/src/mongocxx/test/change_streams.cpp index d06d2c0a01..2db38129cb 100644 --- a/src/mongocxx/test/change_streams.cpp +++ b/src/mongocxx/test/change_streams.cpp @@ -29,10 +29,9 @@ #include #include +#include #include -#include - namespace { using bsoncxx::builder::basic::document; diff --git a/src/mongocxx/test/client.cpp b/src/mongocxx/test/client.cpp index b357ab3836..78f3c91f7d 100644 --- a/src/mongocxx/test/client.cpp +++ b/src/mongocxx/test/client.cpp @@ -24,10 +24,9 @@ #include #include +#include #include -#include - namespace { using namespace mongocxx; diff --git a/src/mongocxx/test/client_session.cpp b/src/mongocxx/test/client_session.cpp index 0ec100e37b..51ebba336b 100644 --- a/src/mongocxx/test/client_session.cpp +++ b/src/mongocxx/test/client_session.cpp @@ -24,9 +24,10 @@ #include #include +#include #include -#include +#include namespace { using bsoncxx::from_json; @@ -234,8 +235,6 @@ TEST_CASE("session", "[session]") { } SECTION("wrong client") { - using Catch::Matchers::Contains; - // "Session argument is for the right client" test from Driver Sessions Spec. // Passing a session from client "c" should fail with client "c2" and related objects. client c2{uri{}, test_util::add_test_server_api()}; diff --git a/src/mongocxx/test/client_side_encryption.cpp b/src/mongocxx/test/client_side_encryption.cpp index 904d5c9005..6ba3854cb0 100644 --- a/src/mongocxx/test/client_side_encryption.cpp +++ b/src/mongocxx/test/client_side_encryption.cpp @@ -42,10 +42,11 @@ #include #include +#include #include #include -#include +#include namespace { const auto kLocalMasterKey = @@ -1719,13 +1720,14 @@ TEST_CASE("Bypass spawning mongocryptd", "[client_side_encryption]") { REQUIRE_THROWS(ping_client["admin"].run_command(make_document(kvp("ping", 1)))); } -class kms_tls_expired_cert_matcher : public Catch::MatcherBase { +class kms_tls_expired_cert_matcher : public Catch::Matchers::MatcherBase { public: bool match(const mongocxx::exception& exc) const override { - return (Catch::Contains("certificate has expired") || // OpenSSL - Catch::Contains("CSSMERR_TP_CERT_EXPIRED") || // Secure Transport - Catch::Contains("certificate has expired") || // Secure Channel - Catch::Contains("certificate has expired")) // LibreSSL + return (Catch::Matchers::ContainsSubstring("certificate has expired") || // OpenSSL + Catch::Matchers::ContainsSubstring( + "CSSMERR_TP_CERT_EXPIRED") || // Secure Transport + Catch::Matchers::ContainsSubstring("certificate has expired") || // Secure Channel + Catch::Matchers::ContainsSubstring("certificate has expired")) // LibreSSL .match(exc.what()); } @@ -1781,13 +1783,15 @@ TEST_CASE("KMS TLS expired certificate", "[client_side_encryption]") { kms_tls_expired_cert_matcher()); } -class kms_tls_wrong_host_cert_matcher : public Catch::MatcherBase { +class kms_tls_wrong_host_cert_matcher : public Catch::Matchers::MatcherBase { public: bool match(const mongocxx::exception& exc) const override { - return (Catch::Contains("IP address mismatch") || // OpenSSL - Catch::Contains("Host name mismatch") || // Secure Transport - Catch::Contains("hostname doesn't match certificate") || // Secure Channel - Catch::Contains("not present in server certificate")) // LibreSSL + return (Catch::Matchers::ContainsSubstring("IP address mismatch") || // OpenSSL + Catch::Matchers::ContainsSubstring("Host name mismatch") || // Secure Transport + Catch::Matchers::ContainsSubstring( + "hostname doesn't match certificate") || // Secure Channel + Catch::Matchers::ContainsSubstring( + "not present in server certificate")) // LibreSSL .match(exc.what()); } @@ -1951,8 +1955,9 @@ TEST_CASE("KMS TLS Options Tests", "[client_side_encryption][!mayfail]") { auto client_encryption_invalid_hostname = make_prose_test_11_ce( &setup_client, "127.0.0.1:9001", "127.0.0.1:9001", "127.0.0.1:9001", with_certs::ca_only); - const auto expired_cert_matcher = Catch::Contains("expired", Catch::CaseSensitive::No); - const auto invalid_hostname_matcher = Catch::Matches( + const auto expired_cert_matcher = + Catch::Matchers::ContainsSubstring("expired", Catch::CaseSensitive::No); + const auto invalid_hostname_matcher = Catch::Matchers::Matches( // Content of error message may vary depending on the SSL library being used. ".*(mismatch|doesn't match|not present).*", Catch::CaseSensitive::No); @@ -1987,7 +1992,7 @@ TEST_CASE("KMS TLS Options Tests", "[client_side_encryption][!mayfail]") { << "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0" << "endpoint" << "127.0.0.1:9002" << finalize)), - Catch::Contains("parse error", Catch::CaseSensitive::No)); + Catch::Matchers::ContainsSubstring("parse error", Catch::CaseSensitive::No)); // Expect an error indicating TLS handshake failed due to an expired certificate. CHECK_THROWS_WITH( @@ -2034,8 +2039,9 @@ TEST_CASE("KMS TLS Options Tests", "[client_side_encryption][!mayfail]") { // Expect an error from libmongocrypt with a message containing the string: "HTTP // status=404". This implies TLS handshake succeeded. - CHECK_THROWS_WITH(client_encryption_with_tls.create_data_key("azure", opts), - Catch::Contains("HTTP status=404", Catch::CaseSensitive::No)); + CHECK_THROWS_WITH( + client_encryption_with_tls.create_data_key("azure", opts), + Catch::Matchers::ContainsSubstring("HTTP status=404", Catch::CaseSensitive::No)); // Expect an error indicating TLS handshake failed due to an expired certificate. CHECK_THROWS_WITH(client_encryption_expired.create_data_key("azure", opts), @@ -2066,8 +2072,9 @@ TEST_CASE("KMS TLS Options Tests", "[client_side_encryption][!mayfail]") { // Expect an error from libmongocrypt with a message containing the string: "HTTP // status=404". This implies TLS handshake succeeded. - CHECK_THROWS_WITH(client_encryption_with_tls.create_data_key("gcp", opts), - Catch::Contains("HTTP status=404", Catch::CaseSensitive::No)); + CHECK_THROWS_WITH( + client_encryption_with_tls.create_data_key("gcp", opts), + Catch::Matchers::ContainsSubstring("HTTP status=404", Catch::CaseSensitive::No)); // Expect an error indicating TLS handshake failed due to an expired certificate. CHECK_THROWS_WITH(client_encryption_expired.create_data_key("gcp", opts), @@ -3453,7 +3460,7 @@ TEST_CASE("Range Explicit Encryption", "[client_side_encryption]") { .algorithm( options::encrypt::encryption_algorithm::k_range_preview) .contention_factor(0)), - Catch::Contains( + Catch::Matchers::ContainsSubstring( "Value must be greater than or equal to the minimum value and " "less than or equal to the maximum value")); } @@ -3491,9 +3498,9 @@ TEST_CASE("Range Explicit Encryption", "[client_side_encryption]") { : to_field_value(6, RangeFieldType::Int); // Assert an error was raised. - REQUIRE_THROWS_WITH( - client_encryption.encrypt(value.view(), encrypt_opts), - Catch::Contains("expected matching 'min' and value type")); + REQUIRE_THROWS_WITH(client_encryption.encrypt(value.view(), encrypt_opts), + Catch::Matchers::ContainsSubstring( + "expected matching 'min' and value type")); } break; } @@ -3538,7 +3545,7 @@ TEST_CASE("Range Explicit Encryption", "[client_side_encryption]") { .algorithm( options::encrypt::encryption_algorithm::k_range_preview) .contention_factor(0)), - Catch::Contains( + Catch::Matchers::ContainsSubstring( "expected 'precision' to be set with double or decimal128 index")); } } break; @@ -3565,7 +3572,8 @@ TEST_CASE("16. Rewrap. Case 2: RewrapManyDataKeyOpts.provider is not optional", REQUIRE_THROWS_WITH( clientEncryption.rewrap_many_datakey( make_document(), mongocxx::options::rewrap_many_datakey().master_key(make_document())), - Catch::Contains("expected 'provider' to be set to identify type of 'master_key'")); + Catch::Matchers::ContainsSubstring( + "expected 'provider' to be set to identify type of 'master_key'")); } } // namespace diff --git a/src/mongocxx/test/collection_mocked.cpp b/src/mongocxx/test/collection_mocked.cpp index 6238451dcd..ffc68fe2c4 100644 --- a/src/mongocxx/test/collection_mocked.cpp +++ b/src/mongocxx/test/collection_mocked.cpp @@ -35,8 +35,7 @@ #include #include - -#include +#include namespace { using namespace mongocxx; diff --git a/src/mongocxx/test/database.cpp b/src/mongocxx/test/database.cpp index e82f6461ff..2bf0284415 100644 --- a/src/mongocxx/test/database.cpp +++ b/src/mongocxx/test/database.cpp @@ -28,9 +28,10 @@ #include #include +#include #include -#include +#include namespace { using namespace mongocxx; @@ -517,7 +518,7 @@ struct check_service_id { check_service_id(const bool expect_service_id) : expect_service_id(expect_service_id) {} void operator()(const EventT& event) { - INFO("checking for service_id()") + INFO("checking for service_id()"); CAPTURE(event.command_name(), expect_service_id); auto service_id = event.service_id(); diff --git a/src/mongocxx/test/index_view.cpp b/src/mongocxx/test/index_view.cpp index c85b1f5306..338f30cb44 100644 --- a/src/mongocxx/test/index_view.cpp +++ b/src/mongocxx/test/index_view.cpp @@ -28,6 +28,9 @@ #include #include +#include +#include + namespace { using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_document; @@ -190,7 +193,7 @@ TEST_CASE("create_one", "[index_view]") { options::index_view options; auto commit_quorum_regex = - Catch::Matches("(.*)commit( )?quorum(.*)", Catch::CaseSensitive::No); + Catch::Matchers::Matches("(.*)commit( )?quorum(.*)", Catch::CaseSensitive::No); bool is_supported = test_util::get_max_wire_version(mongodb_client) >= 9; CAPTURE(is_supported); diff --git a/src/mongocxx/test/model/delete_many.cpp b/src/mongocxx/test/model/delete_many.cpp index a98100d3b1..85ee2e4918 100644 --- a/src/mongocxx/test/model/delete_many.cpp +++ b/src/mongocxx/test/model/delete_many.cpp @@ -17,8 +17,7 @@ #include #include - -#include +#include namespace { using namespace bsoncxx::builder::basic; diff --git a/src/mongocxx/test/model/delete_one.cpp b/src/mongocxx/test/model/delete_one.cpp index 492519f2b8..5d5b0902ae 100644 --- a/src/mongocxx/test/model/delete_one.cpp +++ b/src/mongocxx/test/model/delete_one.cpp @@ -17,8 +17,7 @@ #include #include - -#include +#include namespace { using namespace bsoncxx::builder::basic; diff --git a/src/mongocxx/test/model/replace_one.cpp b/src/mongocxx/test/model/replace_one.cpp index 182d676dc2..c68784e989 100644 --- a/src/mongocxx/test/model/replace_one.cpp +++ b/src/mongocxx/test/model/replace_one.cpp @@ -17,8 +17,7 @@ #include #include - -#include +#include namespace { using namespace bsoncxx::builder::basic; diff --git a/src/mongocxx/test/model/update_many.cpp b/src/mongocxx/test/model/update_many.cpp index 0f43c95d9a..f1d57af6d2 100644 --- a/src/mongocxx/test/model/update_many.cpp +++ b/src/mongocxx/test/model/update_many.cpp @@ -18,8 +18,7 @@ #include #include - -#include +#include namespace { using namespace bsoncxx::builder::basic; diff --git a/src/mongocxx/test/model/update_one.cpp b/src/mongocxx/test/model/update_one.cpp index 87d22b43f1..4ebb7ab311 100644 --- a/src/mongocxx/test/model/update_one.cpp +++ b/src/mongocxx/test/model/update_one.cpp @@ -18,8 +18,7 @@ #include #include - -#include +#include namespace { using namespace bsoncxx::builder::basic; diff --git a/src/mongocxx/test/options/aggregate.cpp b/src/mongocxx/test/options/aggregate.cpp index b56dc4e80c..f70d3ad2f2 100644 --- a/src/mongocxx/test/options/aggregate.cpp +++ b/src/mongocxx/test/options/aggregate.cpp @@ -20,8 +20,7 @@ #include #include - -#include +#include namespace { using namespace bsoncxx::builder::basic; diff --git a/src/mongocxx/test/options/bulk_write.cpp b/src/mongocxx/test/options/bulk_write.cpp index a253ece3c8..f5bc34cf1c 100644 --- a/src/mongocxx/test/options/bulk_write.cpp +++ b/src/mongocxx/test/options/bulk_write.cpp @@ -16,8 +16,7 @@ #include #include - -#include +#include namespace { using namespace mongocxx; diff --git a/src/mongocxx/test/options/count.cpp b/src/mongocxx/test/options/count.cpp index 5048c8007d..8ec1c47026 100644 --- a/src/mongocxx/test/options/count.cpp +++ b/src/mongocxx/test/options/count.cpp @@ -19,8 +19,7 @@ #include #include - -#include +#include namespace { using namespace bsoncxx::builder::basic; diff --git a/src/mongocxx/test/options/create_collection.cpp b/src/mongocxx/test/options/create_collection.cpp index 194672fe92..a14af999cc 100644 --- a/src/mongocxx/test/options/create_collection.cpp +++ b/src/mongocxx/test/options/create_collection.cpp @@ -22,8 +22,7 @@ #include #include - -#include +#include namespace { using namespace bsoncxx; diff --git a/src/mongocxx/test/options/delete.cpp b/src/mongocxx/test/options/delete.cpp index c91f2b3107..03c1850e7f 100644 --- a/src/mongocxx/test/options/delete.cpp +++ b/src/mongocxx/test/options/delete.cpp @@ -19,8 +19,7 @@ #include #include - -#include +#include namespace { using namespace bsoncxx::builder::basic; diff --git a/src/mongocxx/test/options/distinct.cpp b/src/mongocxx/test/options/distinct.cpp index 5482bcea4a..b51b7e1d70 100644 --- a/src/mongocxx/test/options/distinct.cpp +++ b/src/mongocxx/test/options/distinct.cpp @@ -19,8 +19,7 @@ #include #include - -#include +#include namespace { using namespace bsoncxx::builder::basic; diff --git a/src/mongocxx/test/options/find.cpp b/src/mongocxx/test/options/find.cpp index e5fb5e1e9e..3d2ddec8d3 100644 --- a/src/mongocxx/test/options/find.cpp +++ b/src/mongocxx/test/options/find.cpp @@ -19,8 +19,7 @@ #include #include - -#include +#include namespace { using namespace bsoncxx::builder::basic; diff --git a/src/mongocxx/test/options/find_one_and_delete.cpp b/src/mongocxx/test/options/find_one_and_delete.cpp index 0f617ceb9a..caa9e0c018 100644 --- a/src/mongocxx/test/options/find_one_and_delete.cpp +++ b/src/mongocxx/test/options/find_one_and_delete.cpp @@ -19,8 +19,7 @@ #include #include - -#include +#include namespace { using namespace bsoncxx::builder::basic; diff --git a/src/mongocxx/test/options/find_one_and_replace.cpp b/src/mongocxx/test/options/find_one_and_replace.cpp index 1fb43e6339..34a2fe6bbb 100644 --- a/src/mongocxx/test/options/find_one_and_replace.cpp +++ b/src/mongocxx/test/options/find_one_and_replace.cpp @@ -19,8 +19,7 @@ #include #include - -#include +#include namespace { using namespace bsoncxx::builder::basic; diff --git a/src/mongocxx/test/options/find_one_and_update.cpp b/src/mongocxx/test/options/find_one_and_update.cpp index 8df41608c1..678bc91236 100644 --- a/src/mongocxx/test/options/find_one_and_update.cpp +++ b/src/mongocxx/test/options/find_one_and_update.cpp @@ -20,8 +20,7 @@ #include #include - -#include +#include namespace { using namespace bsoncxx::builder::basic; diff --git a/src/mongocxx/test/options/gridfs/bucket.cpp b/src/mongocxx/test/options/gridfs/bucket.cpp index ddeaf8a39e..40161a68c7 100644 --- a/src/mongocxx/test/options/gridfs/bucket.cpp +++ b/src/mongocxx/test/options/gridfs/bucket.cpp @@ -19,8 +19,7 @@ #include #include - -#include +#include namespace { using namespace mongocxx; diff --git a/src/mongocxx/test/options/gridfs/upload.cpp b/src/mongocxx/test/options/gridfs/upload.cpp index 635a055b0e..aec022fc3f 100644 --- a/src/mongocxx/test/options/gridfs/upload.cpp +++ b/src/mongocxx/test/options/gridfs/upload.cpp @@ -18,8 +18,7 @@ #include #include - -#include +#include namespace { using namespace bsoncxx; diff --git a/src/mongocxx/test/options/index.cpp b/src/mongocxx/test/options/index.cpp index d65180239a..8d446f83eb 100644 --- a/src/mongocxx/test/options/index.cpp +++ b/src/mongocxx/test/options/index.cpp @@ -19,8 +19,7 @@ #include #include - -#include +#include namespace { using namespace bsoncxx::builder::basic; diff --git a/src/mongocxx/test/options/insert.cpp b/src/mongocxx/test/options/insert.cpp index b425e83a2b..958ac19fd8 100644 --- a/src/mongocxx/test/options/insert.cpp +++ b/src/mongocxx/test/options/insert.cpp @@ -16,8 +16,7 @@ #include #include - -#include +#include namespace { using namespace mongocxx; diff --git a/src/mongocxx/test/options/replace.cpp b/src/mongocxx/test/options/replace.cpp index 17b2b17ac9..c5140ced70 100644 --- a/src/mongocxx/test/options/replace.cpp +++ b/src/mongocxx/test/options/replace.cpp @@ -17,8 +17,7 @@ #include #include - -#include +#include namespace { using namespace bsoncxx::builder::basic; diff --git a/src/mongocxx/test/options/update.cpp b/src/mongocxx/test/options/update.cpp index 7c59da3cf5..1e41b068a9 100644 --- a/src/mongocxx/test/options/update.cpp +++ b/src/mongocxx/test/options/update.cpp @@ -17,8 +17,7 @@ #include #include - -#include +#include namespace { using namespace bsoncxx::builder::basic; diff --git a/src/mongocxx/test/pool.cpp b/src/mongocxx/test/pool.cpp index 4966e7b983..d6e7773416 100644 --- a/src/mongocxx/test/pool.cpp +++ b/src/mongocxx/test/pool.cpp @@ -25,8 +25,7 @@ #include #include - -#include +#include namespace { using namespace mongocxx; diff --git a/src/mongocxx/test/read_preference.cpp b/src/mongocxx/test/read_preference.cpp index 0f23d78943..6ad031f4d3 100644 --- a/src/mongocxx/test/read_preference.cpp +++ b/src/mongocxx/test/read_preference.cpp @@ -21,8 +21,7 @@ #include #include - -#include +#include namespace { using namespace bsoncxx; diff --git a/src/mongocxx/test/search_index_view.cpp b/src/mongocxx/test/search_index_view.cpp index aabaed70f9..ffb1b40d93 100644 --- a/src/mongocxx/test/search_index_view.cpp +++ b/src/mongocxx/test/search_index_view.cpp @@ -12,6 +12,9 @@ #include #include +#include +#include + namespace { using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_array; @@ -389,7 +392,7 @@ TEST_CASE("atlas search indexes prose tests", "[atlas][search_indexes]") { const auto model = search_index_model(name, definition.view()); REQUIRE_THROWS_WITH(siv.create_one(model), - Catch::Matchers::Contains("Attribute mappings missing")); + Catch::Matchers::ContainsSubstring("Attribute mappings missing")); SUCCEED("Prose Test Case 8: Driver requires explicit type to create a vector search index"); } diff --git a/src/mongocxx/test/spec/util.cpp b/src/mongocxx/test/spec/util.cpp index 68cf5fdece..bda0bb0009 100644 --- a/src/mongocxx/test/spec/util.cpp +++ b/src/mongocxx/test/spec/util.cpp @@ -45,6 +45,8 @@ #include #include +#include + namespace mongocxx { namespace spec { @@ -777,7 +779,9 @@ void run_transaction_operations( auto error_contains = test_util::tolowercase(op["result"]["errorContains"].get_string().value); - REQUIRE_THAT(error_msg, Catch::Contains(error_contains, Catch::CaseSensitive::No)); + REQUIRE_THAT( + error_msg, + Catch::Matchers::ContainsSubstring(error_contains, Catch::CaseSensitive::No)); } // "If the result document has an 'errorCodeName' field, verify that the method threw a diff --git a/src/mongocxx/test/validation_criteria.cpp b/src/mongocxx/test/validation_criteria.cpp index c352bf73d2..6de4db7b81 100644 --- a/src/mongocxx/test/validation_criteria.cpp +++ b/src/mongocxx/test/validation_criteria.cpp @@ -19,8 +19,7 @@ #include #include - -#include +#include namespace { using namespace mongocxx; diff --git a/src/mongocxx/test/versioned_api.cpp b/src/mongocxx/test/versioned_api.cpp index 2276b088c4..d6e69d8ee1 100644 --- a/src/mongocxx/test/versioned_api.cpp +++ b/src/mongocxx/test/versioned_api.cpp @@ -23,6 +23,8 @@ #include #include +#include + using namespace mongocxx; static bool has_api_version_1( @@ -205,7 +207,7 @@ TEST_CASE("Versioned API, with insert-many for 'count' migration") { INFO(error.what()); CHECK(error.code().value() == 323); CHECK_THAT(error.what(), - Catch::StartsWith( + Catch::Matchers::StartsWith( "Provided apiStrict:true, but the command count is not in API Version 1.")); } diff --git a/src/third_party/catch/include/catch.hpp b/src/third_party/catch/include/catch.hpp deleted file mode 100644 index a4e70bf1e0..0000000000 --- a/src/third_party/catch/include/catch.hpp +++ /dev/null @@ -1,17959 +0,0 @@ -/* - * Catch v2.13.7 - * Generated: 2021-07-28 20:29:27.753164 - * ---------------------------------------------------------- - * This file has been merged from multiple headers. Please don't edit it directly - * Copyright (c) 2021 Two Blue Cubes Ltd. All rights reserved. - * - * Distributed under the Boost Software License, Version 1.0. (See accompanying - * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - */ -#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED -#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED -// start catch.hpp - - -#define CATCH_VERSION_MAJOR 2 -#define CATCH_VERSION_MINOR 13 -#define CATCH_VERSION_PATCH 7 - -#ifdef __clang__ -# pragma clang system_header -#elif defined __GNUC__ -# pragma GCC system_header -#endif - -// start catch_suppress_warnings.h - -#ifdef __clang__ -# ifdef __ICC // icpc defines the __clang__ macro -# pragma warning(push) -# pragma warning(disable: 161 1682) -# else // __ICC -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wpadded" -# pragma clang diagnostic ignored "-Wswitch-enum" -# pragma clang diagnostic ignored "-Wcovered-switch-default" -# endif -#elif defined __GNUC__ - // Because REQUIREs trigger GCC's -Wparentheses, and because still - // supported version of g++ have only buggy support for _Pragmas, - // Wparentheses have to be suppressed globally. -# pragma GCC diagnostic ignored "-Wparentheses" // See #674 for details - -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wunused-variable" -# pragma GCC diagnostic ignored "-Wpadded" -#endif -// end catch_suppress_warnings.h -#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER) -# define CATCH_IMPL -# define CATCH_CONFIG_ALL_PARTS -#endif - -// In the impl file, we want to have access to all parts of the headers -// Can also be used to sanely support PCHs -#if defined(CATCH_CONFIG_ALL_PARTS) -# define CATCH_CONFIG_EXTERNAL_INTERFACES -# if defined(CATCH_CONFIG_DISABLE_MATCHERS) -# undef CATCH_CONFIG_DISABLE_MATCHERS -# endif -# if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) -# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER -# endif -#endif - -#if !defined(CATCH_CONFIG_IMPL_ONLY) -// start catch_platform.h - -// See e.g.: -// https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h.auto.html -#ifdef __APPLE__ -# include -# if (defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1) || \ - (defined(TARGET_OS_MAC) && TARGET_OS_MAC == 1) -# define CATCH_PLATFORM_MAC -# elif (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE == 1) -# define CATCH_PLATFORM_IPHONE -# endif - -#elif defined(linux) || defined(__linux) || defined(__linux__) -# define CATCH_PLATFORM_LINUX - -#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__) -# define CATCH_PLATFORM_WINDOWS -#endif - -// end catch_platform.h - -#ifdef CATCH_IMPL -# ifndef CLARA_CONFIG_MAIN -# define CLARA_CONFIG_MAIN_NOT_DEFINED -# define CLARA_CONFIG_MAIN -# endif -#endif - -// start catch_user_interfaces.h - -namespace Catch { - unsigned int rngSeed(); -} - -// end catch_user_interfaces.h -// start catch_tag_alias_autoregistrar.h - -// start catch_common.h - -// start catch_compiler_capabilities.h - -// Detect a number of compiler features - by compiler -// The following features are defined: -// -// CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported? -// CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported? -// CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported? -// CATCH_CONFIG_DISABLE_EXCEPTIONS : Are exceptions enabled? -// **************** -// Note to maintainers: if new toggles are added please document them -// in configuration.md, too -// **************** - -// In general each macro has a _NO_ form -// (e.g. CATCH_CONFIG_NO_POSIX_SIGNALS) which disables the feature. -// Many features, at point of detection, define an _INTERNAL_ macro, so they -// can be combined, en-mass, with the _NO_ forms later. - -#ifdef __cplusplus - -# if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) -# define CATCH_CPP14_OR_GREATER -# endif - -# if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) -# define CATCH_CPP17_OR_GREATER -# endif - -#endif - -// Only GCC compiler should be used in this block, so other compilers trying to -// mask themselves as GCC should be ignored. -#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__) && !defined(__LCC__) -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" ) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" ) - -# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) - -#endif - -#if defined(__clang__) - -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic push" ) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic pop" ) - -// As of this writing, IBM XL's implementation of __builtin_constant_p has a bug -// which results in calls to destructors being emitted for each temporary, -// without a matching initialization. In practice, this can result in something -// like `std::string::~string` being called on an uninitialized value. -// -// For example, this code will likely segfault under IBM XL: -// ``` -// REQUIRE(std::string("12") + "34" == "1234") -// ``` -// -// Therefore, `CATCH_INTERNAL_IGNORE_BUT_WARN` is not implemented. -# if !defined(__ibmxl__) && !defined(__CUDACC__) -# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */ -# endif - -# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \ - _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"") - -# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) - -# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wunused-variable\"" ) - -# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"" ) - -# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wunused-template\"" ) - -#endif // __clang__ - -//////////////////////////////////////////////////////////////////////////////// -// Assume that non-Windows platforms support posix signals by default -#if !defined(CATCH_PLATFORM_WINDOWS) - #define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS -#endif - -//////////////////////////////////////////////////////////////////////////////// -// We know some environments not to support full POSIX signals -#if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__) - #define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS -#endif - -#ifdef __OS400__ -# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS -# define CATCH_CONFIG_COLOUR_NONE -#endif - -//////////////////////////////////////////////////////////////////////////////// -// Android somehow still does not support std::to_string -#if defined(__ANDROID__) -# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING -# define CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE -#endif - -//////////////////////////////////////////////////////////////////////////////// -// Not all Windows environments support SEH properly -#if defined(__MINGW32__) -# define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH -#endif - -//////////////////////////////////////////////////////////////////////////////// -// PS4 -#if defined(__ORBIS__) -# define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE -#endif - -//////////////////////////////////////////////////////////////////////////////// -// Cygwin -#ifdef __CYGWIN__ - -// Required for some versions of Cygwin to declare gettimeofday -// see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin -# define _BSD_SOURCE -// some versions of cygwin (most) do not support std::to_string. Use the libstd check. -// https://gcc.gnu.org/onlinedocs/gcc-4.8.2/libstdc++/api/a01053_source.html line 2812-2813 -# if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \ - && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) - -# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING - -# endif -#endif // __CYGWIN__ - -//////////////////////////////////////////////////////////////////////////////// -// Visual C++ -#if defined(_MSC_VER) - -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) ) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) ) - -// Universal Windows platform does not support SEH -// Or console colours (or console at all...) -# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) -# define CATCH_CONFIG_COLOUR_NONE -# else -# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH -# endif - -// MSVC traditional preprocessor needs some workaround for __VA_ARGS__ -// _MSVC_TRADITIONAL == 0 means new conformant preprocessor -// _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor -# if !defined(__clang__) // Handle Clang masquerading for msvc -# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) -# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -# endif // MSVC_TRADITIONAL -# endif // __clang__ - -#endif // _MSC_VER - -#if defined(_REENTRANT) || defined(_MSC_VER) -// Enable async processing, as -pthread is specified or no additional linking is required -# define CATCH_INTERNAL_CONFIG_USE_ASYNC -#endif // _MSC_VER - -//////////////////////////////////////////////////////////////////////////////// -// Check if we are compiled with -fno-exceptions or equivalent -#if defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND) -# define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED -#endif - -//////////////////////////////////////////////////////////////////////////////// -// DJGPP -#ifdef __DJGPP__ -# define CATCH_INTERNAL_CONFIG_NO_WCHAR -#endif // __DJGPP__ - -//////////////////////////////////////////////////////////////////////////////// -// Embarcadero C++Build -#if defined(__BORLANDC__) - #define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN -#endif - -//////////////////////////////////////////////////////////////////////////////// - -// Use of __COUNTER__ is suppressed during code analysis in -// CLion/AppCode 2017.2.x and former, because __COUNTER__ is not properly -// handled by it. -// Otherwise all supported compilers support COUNTER macro, -// but user still might want to turn it off -#if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L ) - #define CATCH_INTERNAL_CONFIG_COUNTER -#endif - -//////////////////////////////////////////////////////////////////////////////// - -// RTX is a special version of Windows that is real time. -// This means that it is detected as Windows, but does not provide -// the same set of capabilities as real Windows does. -#if defined(UNDER_RTSS) || defined(RTX64_BUILD) - #define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH - #define CATCH_INTERNAL_CONFIG_NO_ASYNC - #define CATCH_CONFIG_COLOUR_NONE -#endif - -#if !defined(_GLIBCXX_USE_C99_MATH_TR1) -#define CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER -#endif - -// Various stdlib support checks that require __has_include -#if defined(__has_include) - // Check if string_view is available and usable - #if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW - #endif - - // Check if optional is available and usable - # if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL - # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) - - // Check if byte is available and usable - # if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # include - # if defined(__cpp_lib_byte) && (__cpp_lib_byte > 0) - # define CATCH_INTERNAL_CONFIG_CPP17_BYTE - # endif - # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) - - // Check if variant is available and usable - # if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # if defined(__clang__) && (__clang_major__ < 8) - // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852 - // fix should be in clang 8, workaround in libstdc++ 8.2 - # include - # if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) - # define CATCH_CONFIG_NO_CPP17_VARIANT - # else - # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT - # endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) - # else - # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT - # endif // defined(__clang__) && (__clang_major__ < 8) - # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) -#endif // defined(__has_include) - -#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) -# define CATCH_CONFIG_COUNTER -#endif -#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH) -# define CATCH_CONFIG_WINDOWS_SEH -#endif -// This is set by default, because we assume that unix compilers are posix-signal-compatible by default. -#if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS) -# define CATCH_CONFIG_POSIX_SIGNALS -#endif -// This is set by default, because we assume that compilers with no wchar_t support are just rare exceptions. -#if !defined(CATCH_INTERNAL_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_WCHAR) -# define CATCH_CONFIG_WCHAR -#endif - -#if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING) -# define CATCH_CONFIG_CPP11_TO_STRING -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_CPP17_OPTIONAL) -# define CATCH_CONFIG_CPP17_OPTIONAL -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW) -# define CATCH_CONFIG_CPP17_STRING_VIEW -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT) -# define CATCH_CONFIG_CPP17_VARIANT -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_BYTE) && !defined(CATCH_CONFIG_NO_CPP17_BYTE) && !defined(CATCH_CONFIG_CPP17_BYTE) -# define CATCH_CONFIG_CPP17_BYTE -#endif - -#if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT) -# define CATCH_INTERNAL_CONFIG_NEW_CAPTURE -#endif - -#if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NEW_CAPTURE) -# define CATCH_CONFIG_NEW_CAPTURE -#endif - -#if !defined(CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) -# define CATCH_CONFIG_DISABLE_EXCEPTIONS -#endif - -#if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN) -# define CATCH_CONFIG_POLYFILL_ISNAN -#endif - -#if defined(CATCH_INTERNAL_CONFIG_USE_ASYNC) && !defined(CATCH_INTERNAL_CONFIG_NO_ASYNC) && !defined(CATCH_CONFIG_NO_USE_ASYNC) && !defined(CATCH_CONFIG_USE_ASYNC) -# define CATCH_CONFIG_USE_ASYNC -#endif - -#if defined(CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_NO_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_ANDROID_LOGWRITE) -# define CATCH_CONFIG_ANDROID_LOGWRITE -#endif - -#if defined(CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_NO_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_GLOBAL_NEXTAFTER) -# define CATCH_CONFIG_GLOBAL_NEXTAFTER -#endif - -// Even if we do not think the compiler has that warning, we still have -// to provide a macro that can be used by the code. -#if !defined(CATCH_INTERNAL_START_WARNINGS_SUPPRESSION) -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION -#endif -#if !defined(CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION -#endif -#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS -#endif -#if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS -#endif -#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS -#endif -#if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS -#endif - -// The goal of this macro is to avoid evaluation of the arguments, but -// still have the compiler warn on problems inside... -#if !defined(CATCH_INTERNAL_IGNORE_BUT_WARN) -# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) -#endif - -#if defined(__APPLE__) && defined(__apple_build_version__) && (__clang_major__ < 10) -# undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS -#elif defined(__clang__) && (__clang_major__ < 5) -# undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS -#endif - -#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS -#endif - -#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) -#define CATCH_TRY if ((true)) -#define CATCH_CATCH_ALL if ((false)) -#define CATCH_CATCH_ANON(type) if ((false)) -#else -#define CATCH_TRY try -#define CATCH_CATCH_ALL catch (...) -#define CATCH_CATCH_ANON(type) catch (type) -#endif - -#if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) -#define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#endif - -// end catch_compiler_capabilities.h -#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line -#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) -#ifdef CATCH_CONFIG_COUNTER -# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ ) -#else -# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ ) -#endif - -#include -#include -#include - -// We need a dummy global operator<< so we can bring it into Catch namespace later -struct Catch_global_namespace_dummy {}; -std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy); - -namespace Catch { - - struct CaseSensitive { enum Choice { - Yes, - No - }; }; - - class NonCopyable { - NonCopyable( NonCopyable const& ) = delete; - NonCopyable( NonCopyable && ) = delete; - NonCopyable& operator = ( NonCopyable const& ) = delete; - NonCopyable& operator = ( NonCopyable && ) = delete; - - protected: - NonCopyable(); - virtual ~NonCopyable(); - }; - - struct SourceLineInfo { - - SourceLineInfo() = delete; - SourceLineInfo( char const* _file, std::size_t _line ) noexcept - : file( _file ), - line( _line ) - {} - - SourceLineInfo( SourceLineInfo const& other ) = default; - SourceLineInfo& operator = ( SourceLineInfo const& ) = default; - SourceLineInfo( SourceLineInfo&& ) noexcept = default; - SourceLineInfo& operator = ( SourceLineInfo&& ) noexcept = default; - - bool empty() const noexcept { return file[0] == '\0'; } - bool operator == ( SourceLineInfo const& other ) const noexcept; - bool operator < ( SourceLineInfo const& other ) const noexcept; - - char const* file; - std::size_t line; - }; - - std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ); - - // Bring in operator<< from global namespace into Catch namespace - // This is necessary because the overload of operator<< above makes - // lookup stop at namespace Catch - using ::operator<<; - - // Use this in variadic streaming macros to allow - // >> +StreamEndStop - // as well as - // >> stuff +StreamEndStop - struct StreamEndStop { - std::string operator+() const; - }; - template - T const& operator + ( T const& value, StreamEndStop ) { - return value; - } -} - -#define CATCH_INTERNAL_LINEINFO \ - ::Catch::SourceLineInfo( __FILE__, static_cast( __LINE__ ) ) - -// end catch_common.h -namespace Catch { - - struct RegistrarForTagAliases { - RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo ); - }; - -} // end namespace Catch - -#define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \ - CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \ - CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION - -// end catch_tag_alias_autoregistrar.h -// start catch_test_registry.h - -// start catch_interfaces_testcase.h - -#include - -namespace Catch { - - class TestSpec; - - struct ITestInvoker { - virtual void invoke () const = 0; - virtual ~ITestInvoker(); - }; - - class TestCase; - struct IConfig; - - struct ITestCaseRegistry { - virtual ~ITestCaseRegistry(); - virtual std::vector const& getAllTests() const = 0; - virtual std::vector const& getAllTestsSorted( IConfig const& config ) const = 0; - }; - - bool isThrowSafe( TestCase const& testCase, IConfig const& config ); - bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); - std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ); - std::vector const& getAllTestCasesSorted( IConfig const& config ); - -} - -// end catch_interfaces_testcase.h -// start catch_stringref.h - -#include -#include -#include -#include - -namespace Catch { - - /// A non-owning string class (similar to the forthcoming std::string_view) - /// Note that, because a StringRef may be a substring of another string, - /// it may not be null terminated. - class StringRef { - public: - using size_type = std::size_t; - using const_iterator = const char*; - - private: - static constexpr char const* const s_empty = ""; - - char const* m_start = s_empty; - size_type m_size = 0; - - public: // construction - constexpr StringRef() noexcept = default; - - StringRef( char const* rawChars ) noexcept; - - constexpr StringRef( char const* rawChars, size_type size ) noexcept - : m_start( rawChars ), - m_size( size ) - {} - - StringRef( std::string const& stdString ) noexcept - : m_start( stdString.c_str() ), - m_size( stdString.size() ) - {} - - explicit operator std::string() const { - return std::string(m_start, m_size); - } - - public: // operators - auto operator == ( StringRef const& other ) const noexcept -> bool; - auto operator != (StringRef const& other) const noexcept -> bool { - return !(*this == other); - } - - auto operator[] ( size_type index ) const noexcept -> char { - assert(index < m_size); - return m_start[index]; - } - - public: // named queries - constexpr auto empty() const noexcept -> bool { - return m_size == 0; - } - constexpr auto size() const noexcept -> size_type { - return m_size; - } - - // Returns the current start pointer. If the StringRef is not - // null-terminated, throws std::domain_exception - auto c_str() const -> char const*; - - public: // substrings and searches - // Returns a substring of [start, start + length). - // If start + length > size(), then the substring is [start, size()). - // If start > size(), then the substring is empty. - auto substr( size_type start, size_type length ) const noexcept -> StringRef; - - // Returns the current start pointer. May not be null-terminated. - auto data() const noexcept -> char const*; - - constexpr auto isNullTerminated() const noexcept -> bool { - return m_start[m_size] == '\0'; - } - - public: // iterators - constexpr const_iterator begin() const { return m_start; } - constexpr const_iterator end() const { return m_start + m_size; } - }; - - auto operator += ( std::string& lhs, StringRef const& sr ) -> std::string&; - auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&; - - constexpr auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { - return StringRef( rawChars, size ); - } -} // namespace Catch - -constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef { - return Catch::StringRef( rawChars, size ); -} - -// end catch_stringref.h -// start catch_preprocessor.hpp - - -#define CATCH_RECURSION_LEVEL0(...) __VA_ARGS__ -#define CATCH_RECURSION_LEVEL1(...) CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL2(...) CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL3(...) CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL4(...) CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL5(...) CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(__VA_ARGS__))) - -#ifdef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_EXPAND_VARGS(...) __VA_ARGS__ -// MSVC needs more evaluations -#define CATCH_RECURSION_LEVEL6(...) CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__))) -#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__)) -#else -#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__) -#endif - -#define CATCH_REC_END(...) -#define CATCH_REC_OUT - -#define CATCH_EMPTY() -#define CATCH_DEFER(id) id CATCH_EMPTY() - -#define CATCH_REC_GET_END2() 0, CATCH_REC_END -#define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2 -#define CATCH_REC_GET_END(...) CATCH_REC_GET_END1 -#define CATCH_REC_NEXT0(test, next, ...) next CATCH_REC_OUT -#define CATCH_REC_NEXT1(test, next) CATCH_DEFER ( CATCH_REC_NEXT0 ) ( test, next, 0) -#define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next) - -#define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0) ) ( f, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST2(f, x, peek, ...) f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) - -#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD) ) ( f, userdata, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) - -// Applies the function macro `f` to each of the remaining parameters, inserts commas between the results, -// and passes userdata as the first parameter to each invocation, -// e.g. CATCH_REC_LIST_UD(f, x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c) -#define CATCH_REC_LIST_UD(f, userdata, ...) CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) - -#define CATCH_REC_LIST(f, ...) CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) - -#define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param) -#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__ -#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__ -#define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF -#define INTERNAL_CATCH_STRINGIZE(...) INTERNAL_CATCH_STRINGIZE2(__VA_ARGS__) -#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_STRINGIZE2(...) #__VA_ARGS__ -#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) -#else -// MSVC is adding extra space and needs another indirection to expand INTERNAL_CATCH_NOINTERNAL_CATCH_DEF -#define INTERNAL_CATCH_STRINGIZE2(...) INTERNAL_CATCH_STRINGIZE3(__VA_ARGS__) -#define INTERNAL_CATCH_STRINGIZE3(...) #__VA_ARGS__ -#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) (INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) + 1) -#endif - -#define INTERNAL_CATCH_MAKE_NAMESPACE2(...) ns_##__VA_ARGS__ -#define INTERNAL_CATCH_MAKE_NAMESPACE(name) INTERNAL_CATCH_MAKE_NAMESPACE2(name) - -#define INTERNAL_CATCH_REMOVE_PARENS(...) INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF __VA_ARGS__) - -#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) decltype(get_wrapper()) -#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)) -#else -#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) INTERNAL_CATCH_EXPAND_VARGS(decltype(get_wrapper())) -#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))) -#endif - -#define INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(...)\ - CATCH_REC_LIST(INTERNAL_CATCH_MAKE_TYPE_LIST,__VA_ARGS__) - -#define INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_0) INTERNAL_CATCH_REMOVE_PARENS(_0) -#define INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_0, _1) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_1) -#define INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_0, _1, _2) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_1, _2) -#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3) -#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4) -#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5) -#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _3, _4, _5, _6) -#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7) -#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8) -#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9) -#define INTERNAL_CATCH_REMOVE_PARENS_11_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) - -#define INTERNAL_CATCH_VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N - -#define INTERNAL_CATCH_TYPE_GEN\ - template struct TypeList {};\ - template\ - constexpr auto get_wrapper() noexcept -> TypeList { return {}; }\ - template class...> struct TemplateTypeList{};\ - template class...Cs>\ - constexpr auto get_wrapper() noexcept -> TemplateTypeList { return {}; }\ - template\ - struct append;\ - template\ - struct rewrap;\ - template class, typename...>\ - struct create;\ - template class, typename>\ - struct convert;\ - \ - template \ - struct append { using type = T; };\ - template< template class L1, typename...E1, template class L2, typename...E2, typename...Rest>\ - struct append, L2, Rest...> { using type = typename append, Rest...>::type; };\ - template< template class L1, typename...E1, typename...Rest>\ - struct append, TypeList, Rest...> { using type = L1; };\ - \ - template< template class Container, template class List, typename...elems>\ - struct rewrap, List> { using type = TypeList>; };\ - template< template class Container, template class List, class...Elems, typename...Elements>\ - struct rewrap, List, Elements...> { using type = typename append>, typename rewrap, Elements...>::type>::type; };\ - \ - template