Skip to content

CXX-2753 Move test files into test subdirectory #1041

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/bsoncxx/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ set_dist_list(src_bsoncxx_lib_DIST
bsoncxx/v_noabi/bsoncxx/private/stack.hh
bsoncxx/v_noabi/bsoncxx/private/suppress_deprecation_warnings.hh
bsoncxx/v_noabi/bsoncxx/string/view_or_value.cpp
bsoncxx/v_noabi/bsoncxx/test_util/catch.hh
bsoncxx/v_noabi/bsoncxx/test_util/export_for_testing.hh
bsoncxx/v_noabi/bsoncxx/test_util/to_string.hh
bsoncxx/v_noabi/bsoncxx/types.cpp
bsoncxx/v_noabi/bsoncxx/types/bson_value/private/value.hh
bsoncxx/v_noabi/bsoncxx/types/bson_value/value.cpp
Expand Down
13 changes: 9 additions & 4 deletions src/bsoncxx/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ endif()

target_compile_definitions(bsoncxx_testing PUBLIC BSONCXX_TESTING)

# Allow `#include <third_party/catch/include/...>`
target_include_directories(bsoncxx_testing PUBLIC ${THIRD_PARTY_SOURCE_DIR}/..)

add_executable(test_bson
array.cpp
bson_b_date.cpp
Expand All @@ -46,7 +43,13 @@ add_executable(test_bson
add_library(bsoncxx_test_properties INTERFACE)
target_sources(bsoncxx_test_properties INTERFACE ${THIRD_PARTY_SOURCE_DIR}/catch/main.cpp)
target_link_libraries(bsoncxx_test_properties INTERFACE bsoncxx_testing ${libbson_target})
target_include_directories(bsoncxx_test_properties INTERFACE ${libbson_include_directories})
target_include_directories(bsoncxx_test_properties INTERFACE
# Allow `#include <bson/bson.h>`
${libbson_include_directories}

# Allow `#include <bsoncxx/test/...>` and `#include <third_party/...>`.
${CMAKE_CURRENT_SOURCE_DIR}/../..
)
target_compile_definitions(bsoncxx_test_properties INTERFACE ${libbson_definitions})

target_link_libraries(test_bson PRIVATE bsoncxx_test_properties)
Expand All @@ -64,7 +67,9 @@ set_dist_list(src_bsoncxx_test_DIST
bson_util_itoa.cpp
bson_validate.cpp
bson_value.cpp
catch.hh
json.cpp
oid.cpp
to_string.hh
view_or_value.cpp
)
2 changes: 1 addition & 1 deletion src/bsoncxx/test/array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <bsoncxx/array/view.hpp>
#include <bsoncxx/builder/basic/array.hpp>
#include <bsoncxx/test_util/catch.hh>
#include <bsoncxx/test/catch.hh>
#include <bsoncxx/types.hpp>
#include <bsoncxx/types/bson_value/make_value.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/bsoncxx/test/bson_b_date.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <chrono>

#include <bsoncxx/test_util/catch.hh>
#include <bsoncxx/test/catch.hh>
#include <bsoncxx/types.hpp>

namespace {
Expand Down
2 changes: 1 addition & 1 deletion src/bsoncxx/test/bson_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <bsoncxx/json.hpp>
#include <bsoncxx/private/libbson.hh>
#include <bsoncxx/string/to_string.hpp>
#include <bsoncxx/test_util/catch.hh>
#include <bsoncxx/test/catch.hh>
#include <bsoncxx/types.hpp>
#include <bsoncxx/types/bson_value/view.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/bsoncxx/test/bson_get_values.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <bsoncxx/builder/basic/array.hpp>
#include <bsoncxx/builder/basic/document.hpp>
#include <bsoncxx/builder/basic/sub_array.hpp>
#include <bsoncxx/test_util/catch.hh>
#include <bsoncxx/test/catch.hh>

namespace {
using namespace bsoncxx;
Expand Down
2 changes: 1 addition & 1 deletion src/bsoncxx/test/bson_serialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <bsoncxx/builder/basic/document.hpp>
#include <bsoncxx/document/value.hpp>
#include <bsoncxx/string/to_string.hpp>
#include <bsoncxx/test_util/catch.hh>
#include <bsoncxx/test/catch.hh>
#include <bsoncxx/types/bson_value/view.hpp>

namespace {
Expand Down
2 changes: 1 addition & 1 deletion src/bsoncxx/test/bson_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <bsoncxx/builder/basic/document.hpp>
#include <bsoncxx/document/element.hpp>
#include <bsoncxx/stdx/string_view.hpp>
#include <bsoncxx/test_util/catch.hh>
#include <bsoncxx/test/catch.hh>
#include <bsoncxx/types.hpp>
#include <bsoncxx/types/bson_value/view.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/bsoncxx/test/bson_util_itoa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

#include <bsoncxx/private/itoa.hh>
#include <bsoncxx/test_util/catch.hh>
#include <bsoncxx/test/catch.hh>

namespace {
TEST_CASE("util::itoa is equivalent to to_string(int)", "[bsoncxx::util::itoa]") {
Expand Down
2 changes: 1 addition & 1 deletion src/bsoncxx/test/bson_validate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <bsoncxx/builder/basic/document.hpp>
#include <bsoncxx/builder/basic/kvp.hpp>
#include <bsoncxx/builder/basic/sub_array.hpp>
#include <bsoncxx/test_util/catch.hh>
#include <bsoncxx/test/catch.hh>
#include <bsoncxx/validate.hpp>

namespace {
Expand Down
2 changes: 1 addition & 1 deletion src/bsoncxx/test/bson_value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <bsoncxx/builder/basic/document.hpp>
#include <bsoncxx/builder/basic/kvp.hpp>
#include <bsoncxx/document/view.hpp>
#include <bsoncxx/test_util/catch.hh>
#include <bsoncxx/test/catch.hh>
#include <bsoncxx/types/bson_value/make_value.hpp>
#include <bsoncxx/types/bson_value/value.hpp>
#include <bsoncxx/types/bson_value/view.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <bsoncxx/json.hpp>
#include <bsoncxx/oid.hpp>
#include <bsoncxx/stdx/optional.hpp>
#include <bsoncxx/test_util/to_string.hh>
#include <bsoncxx/test/to_string.hh>
#include <third_party/catch/include/catch.hpp>

#include <bsoncxx/config/private/prelude.hh>
Expand Down
2 changes: 1 addition & 1 deletion src/bsoncxx/test/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <bsoncxx/exception/exception.hpp>
#include <bsoncxx/json.hpp>
#include <bsoncxx/private/libbson.hh>
#include <bsoncxx/test_util/catch.hh>
#include <bsoncxx/test/catch.hh>

namespace {
using bsoncxx::builder::basic::kvp;
Expand Down
2 changes: 1 addition & 1 deletion src/bsoncxx/test/oid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include <bsoncxx/oid.hpp>
#include <bsoncxx/private/libbson.hh>
#include <bsoncxx/test_util/catch.hh>
#include <bsoncxx/test/catch.hh>

using namespace bsoncxx;

Expand Down
2 changes: 1 addition & 1 deletion src/bsoncxx/test/view_or_value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <bsoncxx/document/view_or_value.hpp>
#include <bsoncxx/json.hpp>
#include <bsoncxx/string/view_or_value.hpp>
#include <bsoncxx/test_util/catch.hh>
#include <bsoncxx/test/catch.hh>

namespace {
using namespace bsoncxx;
Expand Down
2 changes: 0 additions & 2 deletions src/mongocxx/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,6 @@ set_dist_list(src_mongocxx_lib_DIST
mongocxx/v_noabi/mongocxx/result/update.cpp
mongocxx/v_noabi/mongocxx/search_index_model.cpp
mongocxx/v_noabi/mongocxx/search_index_view.cpp
mongocxx/v_noabi/mongocxx/test_util/client_helpers.cpp
mongocxx/v_noabi/mongocxx/test_util/client_helpers.hh
mongocxx/v_noabi/mongocxx/test_util/export_for_testing.hh
mongocxx/v_noabi/mongocxx/test_util/mock.hh
mongocxx/v_noabi/mongocxx/uri.cpp
Expand Down
37 changes: 20 additions & 17 deletions src/mongocxx/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(mongocxx_mocked PRIVATE /bigobj)
endif()

# Allow `#include <third_party/catch/include/...>`
target_include_directories(mongocxx_mocked PUBLIC ${THIRD_PARTY_SOURCE_DIR}/..)

set(spec_test_common
spec/operation.cpp
spec/unified_tests/entity.cpp
Expand All @@ -40,11 +37,10 @@ set(spec_test_common
spec/util.cpp
)

set(client_helpers_cpp ${PROJECT_SOURCE_DIR}/lib/mongocxx/v_noabi/mongocxx/test_util/client_helpers.cpp)

add_executable(test_driver
bulk_write.cpp
change_streams.cpp
client_helpers.cpp
client_session.cpp
client_side_encryption.cpp
client.cpp
Expand Down Expand Up @@ -105,7 +101,6 @@ add_executable(test_driver
uri.cpp
validation_criteria.cpp
write_concern.cpp
${client_helpers_cpp}
)

add_executable(test_logging
Expand All @@ -119,69 +114,75 @@ add_executable(test_instance
add_executable(test_crud_specs
spec/crud.cpp
${spec_test_common}
${client_helpers_cpp}
client_helpers.cpp
)

add_executable(test_gridfs_specs
spec/gridfs.cpp
${spec_test_common}
${client_helpers_cpp}
client_helpers.cpp
)

add_executable(test_client_side_encryption_specs
spec/client_side_encryption.cpp
${spec_test_common}
${client_helpers_cpp}
client_helpers.cpp
)

add_executable(test_command_monitoring_specs
spec/command_monitoring.cpp
${spec_test_common}
${client_helpers_cpp}
client_helpers.cpp
)

add_executable(test_transactions_specs
spec/transactions.cpp
${spec_test_common}
${client_helpers_cpp}
client_helpers.cpp
)

add_executable(test_retryable_reads_specs
spec/retryable-reads.cpp
${spec_test_common}
${client_helpers_cpp}
client_helpers.cpp
)

add_executable(test_read_write_concern_specs
spec/read_write_concern.cpp
${spec_test_common}
${client_helpers_cpp}
client_helpers.cpp
)

add_executable(test_mongohouse_specs
spec/mongohouse.cpp
${spec_test_common}
${client_helpers_cpp}
client_helpers.cpp
)

add_executable(test_unified_format_spec
spec/unified_tests/operations.cpp
spec/unified_tests/runner.cpp
${spec_test_common}
${client_helpers_cpp}
client_helpers.cpp
)

add_executable(test_versioned_api
versioned_api.cpp
${spec_test_common}
${client_helpers_cpp}
client_helpers.cpp
)

# Common target properties for test executables.
add_library(mongocxx_test_properties INTERFACE)
target_sources(mongocxx_test_properties INTERFACE ${THIRD_PARTY_SOURCE_DIR}/catch/main.cpp)
target_link_libraries(mongocxx_test_properties INTERFACE mongocxx_mocked ${libmongoc_target})
target_include_directories(mongocxx_test_properties INTERFACE ${libmongoc_include_directories})
target_include_directories(mongocxx_test_properties INTERFACE
# Allow `#include <mongoc/mongoc.h>`
${libmongoc_include_directories}

# Allow `#include <mongocxx/test/...>` and `#include <third_party/...>`.
${CMAKE_CURRENT_SOURCE_DIR}/../..
)

target_link_libraries(test_driver PRIVATE mongocxx_test_properties)
target_link_libraries(test_logging PRIVATE mongocxx_test_properties)
Expand Down Expand Up @@ -289,6 +290,8 @@ set_dist_list(src_mongocxx_test_DIST
CMakeLists.txt
bulk_write.cpp
change_streams.cpp
client_helpers.cpp
client_helpers.hh
client_session.cpp
client_side_encryption.cpp
client.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/mongocxx/test/bulk_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

#include <bsoncxx/builder/basic/document.hpp>
#include <bsoncxx/test_util/catch.hh>
#include <bsoncxx/test/catch.hh>
#include <bsoncxx/types.hpp>
#include <mongocxx/bulk_write.hpp>
#include <mongocxx/client.hpp>
Expand Down
4 changes: 2 additions & 2 deletions src/mongocxx/test/change_streams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <bsoncxx/builder/basic/document.hpp>
#include <bsoncxx/document/value.hpp>
#include <bsoncxx/private/libbson.hh>
#include <bsoncxx/test_util/catch.hh>
#include <bsoncxx/test/catch.hh>
#include <mongocxx/client.hpp>
#include <mongocxx/collection.hpp>
#include <mongocxx/instance.hpp>
Expand All @@ -27,7 +27,7 @@
#include <mongocxx/pipeline.hpp>
#include <mongocxx/pool.hpp>
#include <mongocxx/private/libbson.hh>
#include <mongocxx/test_util/client_helpers.hh>
#include <mongocxx/test/client_helpers.hh>
#include <mongocxx/write_concern.hpp>
#include <third_party/catch/include/helpers.hpp>

Expand Down
4 changes: 2 additions & 2 deletions src/mongocxx/test/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
// limitations under the License.

#include <bsoncxx/string/to_string.hpp>
#include <bsoncxx/test_util/catch.hh>
#include <bsoncxx/test/catch.hh>
#include <mongocxx/client.hpp>
#include <mongocxx/exception/logic_error.hpp>
#include <mongocxx/instance.hpp>
#include <mongocxx/pool.hpp>
#include <mongocxx/private/conversions.hh>
#include <mongocxx/private/libmongoc.hh>
#include <mongocxx/test_util/client_helpers.hh>
#include <mongocxx/test/client_helpers.hh>
#include <mongocxx/uri.hpp>
#include <third_party/catch/include/helpers.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <mongocxx/exception/logic_error.hpp>
#include <mongocxx/exception/operation_exception.hpp>
#include <mongocxx/private/libmongoc.hh>
#include <mongocxx/test_util/client_helpers.hh>
#include <mongocxx/test/client_helpers.hh>
#include <third_party/catch/include/catch.hpp>

#include <mongocxx/config/private/prelude.hh>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
#include <bsoncxx/stdx/string_view.hpp>
#include <bsoncxx/types.hpp>
#include <bsoncxx/types/bson_value/view.hpp>
#include <mongocxx/client.hpp>
#include <mongocxx/collection.hpp>
#include <mongocxx/options/client.hpp>
#include <mongocxx/stdx.hpp>
#include <third_party/catch/include/catch.hpp>

Expand Down
4 changes: 2 additions & 2 deletions src/mongocxx/test/client_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@

#include <bsoncxx/private/helpers.hh>
#include <bsoncxx/stdx/make_unique.hpp>
#include <bsoncxx/test_util/catch.hh>
#include <bsoncxx/test/catch.hh>
#include <mongocxx/client.hpp>
#include <mongocxx/exception/bulk_write_exception.hpp>
#include <mongocxx/exception/logic_error.hpp>
#include <mongocxx/exception/server_error_code.hpp>
#include <mongocxx/instance.hpp>
#include <mongocxx/private/libmongoc.hh>
#include <mongocxx/test_util/client_helpers.hh>
#include <mongocxx/test/client_helpers.hh>
#include <third_party/catch/include/helpers.hpp>

namespace {
Expand Down
4 changes: 2 additions & 2 deletions src/mongocxx/test/client_side_encryption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <bsoncxx/document/element.hpp>
#include <bsoncxx/stdx/make_unique.hpp>
#include <bsoncxx/stdx/string_view.hpp>
#include <bsoncxx/test_util/catch.hh>
#include <bsoncxx/test/catch.hh>
#include <bsoncxx/types.hpp>
#include <bsoncxx/types/bson_value/make_value.hpp>
#include <bsoncxx/types/bson_value/value.hpp>
Expand All @@ -37,8 +37,8 @@
#include <mongocxx/options/client_encryption.hpp>
#include <mongocxx/options/data_key.hpp>
#include <mongocxx/private/libbson.hh>
#include <mongocxx/test/client_helpers.hh>
#include <mongocxx/test/spec/monitoring.hh>
#include <mongocxx/test_util/client_helpers.hh>
#include <mongocxx/uri.hpp>
#include <mongocxx/write_concern.hpp>
#include <third_party/catch/include/helpers.hpp>
Expand Down
Loading