mirror of
https://github.com/microsoft/GSL.git
synced 2025-04-02 09:18:33 -04:00
activate commented out tests
This commit is contained in:
parent
e55946da6e
commit
f5ba439b11
@ -215,6 +215,14 @@ TEST(span_test, from_pointer_length_constructor)
|
|||||||
|
|
||||||
TEST(span_test, from_pointer_pointer_construction)
|
TEST(span_test, from_pointer_pointer_construction)
|
||||||
{
|
{
|
||||||
|
#if !(defined _MSVC_STL_VERSION) || defined(NDEBUG)
|
||||||
|
const auto terminateHandler = std::set_terminate([] {
|
||||||
|
std::cerr << "Expected Death. from_pointer_pointer_construction";
|
||||||
|
std::abort();
|
||||||
|
});
|
||||||
|
const auto expected = GetExpectedDeathString(terminateHandler);
|
||||||
|
#endif
|
||||||
|
|
||||||
int arr[4] = {1, 2, 3, 4};
|
int arr[4] = {1, 2, 3, 4};
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -244,18 +252,20 @@ TEST(span_test, from_pointer_pointer_construction)
|
|||||||
EXPECT_TRUE(s.data() == &arr[0]);
|
EXPECT_TRUE(s.data() == &arr[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !(defined _MSVC_STL_VERSION) || defined(NDEBUG)
|
||||||
// this will fail the std::distance() precondition, which asserts on MSVC debug builds
|
// this will fail the std::distance() precondition, which asserts on MSVC debug builds
|
||||||
//{
|
{
|
||||||
// auto workaround_macro = [&]() { span<int> s{&arr[1], &arr[0]}; };
|
auto workaround_macro = [&]() { span<int> s{&arr[1], &arr[0]}; };
|
||||||
// EXPECT_DEATH(workaround_macro(), expected);
|
EXPECT_DEATH(workaround_macro(), expected);
|
||||||
//}
|
}
|
||||||
|
|
||||||
// this will fail the std::distance() precondition, which asserts on MSVC debug builds
|
// this will fail the std::distance() precondition, which asserts on MSVC debug builds
|
||||||
//{
|
{
|
||||||
// int* p = nullptr;
|
int* p = nullptr;
|
||||||
// auto workaround_macro = [&]() { span<int> s{&arr[0], p}; };
|
auto workaround_macro = [&]() { span<int> s{&arr[0], p}; };
|
||||||
// EXPECT_DEATH(workaround_macro(), expected);
|
EXPECT_DEATH(workaround_macro(), expected);
|
||||||
//}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
int* p = nullptr;
|
int* p = nullptr;
|
||||||
@ -271,12 +281,14 @@ TEST(span_test, from_pointer_pointer_construction)
|
|||||||
EXPECT_TRUE(s.data() == nullptr);
|
EXPECT_TRUE(s.data() == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !(defined _MSVC_STL_VERSION) || defined(NDEBUG)
|
||||||
// this will fail the std::distance() precondition, which asserts on MSVC debug builds
|
// this will fail the std::distance() precondition, which asserts on MSVC debug builds
|
||||||
//{
|
{
|
||||||
// int* p = nullptr;
|
int* p = nullptr;
|
||||||
// auto workaround_macro = [&]() { span<int> s{&arr[0], p}; };
|
auto workaround_macro = [&]() { span<int> s{&arr[0], p}; };
|
||||||
// EXPECT_DEATH(workaround_macro(), expected);
|
EXPECT_DEATH(workaround_macro(), expected);
|
||||||
//}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(span_test, from_array_constructor)
|
TEST(span_test, from_array_constructor)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user