mirror of
https://github.com/microsoft/GSL.git
synced 2025-09-26 15:11:38 +02:00
infra: individual test executables
We used have tests contained in a single executable. This was fine for testing, but it would be more convient to separate tests into indivudal modules so targeted changes could have targeted tests. This change associates each test file with its own executable. We now have 14 tests for GSL each of which testing a different component.
This commit is contained in:
@@ -101,6 +101,7 @@ if(MSVC) # MSVC or simulating MSVC
|
||||
-Wfloat-equal
|
||||
-Wno-c++98-compat
|
||||
-Wno-c++98-compat-pedantic
|
||||
-Wno-reserved-identifier
|
||||
-Wno-covered-switch-default # GTest
|
||||
-Wno-deprecated-declarations # Allow tests for [[deprecated]] elements
|
||||
-Wno-global-constructors # GTest
|
||||
@@ -199,29 +200,34 @@ target_include_directories(gsl_tests_config SYSTEM INTERFACE
|
||||
googletest/googletest/include
|
||||
)
|
||||
|
||||
add_executable(gsl_tests
|
||||
algorithm_tests.cpp
|
||||
assertion_tests.cpp
|
||||
at_tests.cpp
|
||||
byte_tests.cpp
|
||||
constexpr_notnull_tests.cpp
|
||||
notnull_tests.cpp
|
||||
owner_tests.cpp
|
||||
pointers_tests.cpp
|
||||
span_compatibility_tests.cpp
|
||||
span_ext_tests.cpp
|
||||
span_tests.cpp
|
||||
strict_notnull_tests.cpp
|
||||
|
||||
utils_tests.cpp
|
||||
# Individually build and register each test source (except no_exception_ensure_tests.cpp)
|
||||
set(GSL_TEST_SOURCES
|
||||
algorithm_tests.cpp
|
||||
assertion_tests.cpp
|
||||
at_tests.cpp
|
||||
byte_tests.cpp
|
||||
constexpr_notnull_tests.cpp
|
||||
notnull_tests.cpp
|
||||
owner_tests.cpp
|
||||
pointers_tests.cpp
|
||||
span_compatibility_tests.cpp
|
||||
span_ext_tests.cpp
|
||||
span_tests.cpp
|
||||
strict_notnull_tests.cpp
|
||||
utils_tests.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(gsl_tests
|
||||
foreach(src IN LISTS GSL_TEST_SOURCES)
|
||||
get_filename_component(test_name "${src}" NAME_WE)
|
||||
add_executable(${test_name} ${src})
|
||||
target_link_libraries(${test_name}
|
||||
Microsoft.GSL::GSL
|
||||
gsl_tests_config
|
||||
${GTestMain_LIBRARIES}
|
||||
)
|
||||
add_test(gsl_tests gsl_tests)
|
||||
)
|
||||
add_test(NAME ${test_name} COMMAND ${test_name})
|
||||
set_target_properties(${test_name} PROPERTIES FOLDER "tests")
|
||||
endforeach()
|
||||
|
||||
# No exception tests
|
||||
|
||||
|
@@ -412,8 +412,8 @@ TEST(span_test, from_std_array_constructor)
|
||||
static_assert(!CtorCompilesFor<span<int, 5>, std::array<int, 4>&>,
|
||||
"!CtorCompilesFor<span<int, 5>, std::array<int, 4>&>");
|
||||
|
||||
#if !defined(_MSC_VER) || (_MSC_VER > 1943) || (__cplusplus >= 201703L)
|
||||
// Fails on "Visual Studio 16 2019/Visual Studio 17 2022, windows-2019/2022, Debug/Release, 14".
|
||||
#if !defined(_MSC_VER) || (__cplusplus >= 201703L)
|
||||
// The following static assertion fails on MSVC in C++14 mode.
|
||||
static_assert(!ConversionCompilesFor<span<int>, std::array<int, 4>>,
|
||||
"!ConversionCompilesFor<span<int>, std::array<int, 4>>");
|
||||
#endif
|
||||
@@ -529,8 +529,8 @@ TEST(span_test, from_container_constructor)
|
||||
EXPECT_TRUE(cs.data() == cstr.data());
|
||||
}
|
||||
|
||||
#if !defined(_MSC_VER) || (_MSC_VER > 1943) || (__cplusplus >= 201703L)
|
||||
// Fails on "Visual Studio 16 2019/Visual Studio 17 2022, windows-2019/2022, Debug/Release, 14".
|
||||
#if !defined(_MSC_VER) || (__cplusplus >= 201703L)
|
||||
// The following static assertion fails on MSVC in C++14 mode.
|
||||
static_assert(!ConversionCompilesFor<span<int>, std::vector<int>>,
|
||||
"!ConversionCompilesFor<span<int>, std::vector<int>>");
|
||||
#endif // !defined(_MSC_VER) || (_MSC_VER > 1942) || (__cplusplus >= 201703L)
|
||||
|
Reference in New Issue
Block a user