Restoring empty_array_view tests.

This commit is contained in:
Neil MacIntosh 2015-09-14 17:57:29 -07:00
parent c6a2f8c086
commit 3ff9b17a9f

View File

@ -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)