mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
Restoring empty_array_view tests.
This commit is contained in:
parent
c6a2f8c086
commit
3ff9b17a9f
@ -758,20 +758,62 @@ SUITE(array_view_tests)
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
array_view<int, 0> empty_av(nullptr);
|
||||
|
||||
CHECK(empty_av.bounds().index_bounds() == index<1>{ 0 });
|
||||
CHECK_THROW(empty_av[0], fail_fast);
|
||||
CHECK_THROW(empty_av.begin()[0], fail_fast);
|
||||
CHECK_THROW(empty_av.cbegin()[0], fail_fast);
|
||||
|
||||
for (auto& v : empty_av)
|
||||
{
|
||||
CHECK(false);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
array_view<int> empty_av = {};
|
||||
|
||||
CHECK(empty_av.bounds().index_bounds() == index<1>{ 0 });
|
||||
CHECK_THROW(empty_av[0], fail_fast);
|
||||
CHECK_THROW(empty_av.begin()[0], fail_fast);
|
||||
CHECK_THROW(empty_av.cbegin()[0], fail_fast);
|
||||
|
||||
for (auto& v : empty_av)
|
||||
{
|
||||
CHECK(false);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
array_view<int, 0> empty_av(nullptr);
|
||||
strided_array_view<int, 1> empty_sav{ empty_av, { 0, 1 } };
|
||||
|
||||
CHECK(empty_sav.bounds().index_bounds() == index<1>{ 0 });
|
||||
CHECK_THROW(empty_sav[0], fail_fast);
|
||||
CHECK_THROW(empty_sav.begin()[0], fail_fast);
|
||||
CHECK_THROW(empty_sav.cbegin()[0], fail_fast);
|
||||
|
||||
strided_array_view<int, 1> empty_sav2{ nullptr, 0, { 0, 1 } };
|
||||
for (auto& v : empty_sav)
|
||||
{
|
||||
CHECK(false);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
strided_array_view<int, 1> empty_sav{ nullptr, 0, { 0, 1 } };
|
||||
|
||||
CHECK(empty_sav.bounds().index_bounds() == index<1>{ 0 });
|
||||
CHECK_THROW(empty_sav[0], fail_fast);
|
||||
CHECK_THROW(empty_sav.begin()[0], fail_fast);
|
||||
CHECK_THROW(empty_sav.cbegin()[0], fail_fast);
|
||||
|
||||
for (auto& v : empty_sav)
|
||||
{
|
||||
CHECK(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST(index_constructor)
|
||||
|
Loading…
Reference in New Issue
Block a user