update index_type to size_type, fix a couple Expects

This commit is contained in:
Jordan Maples [MSFT]
2020-02-04 15:31:33 -08:00
parent 61c6ef8d42
commit 5a1e4f3953
3 changed files with 17 additions and 15 deletions
+7 -7
View File
@@ -105,17 +105,17 @@ TEST(span_test, from_nullptr_size_constructor)
std::abort();
});
{
span<int> s{nullptr, narrow_cast<span<int>::index_type>(0)};
span<int> s{nullptr, narrow_cast<span<int>::size_type>(0)};
EXPECT_TRUE(s.size() == 0);
EXPECT_TRUE(s.data() == nullptr);
span<int> cs{nullptr, narrow_cast<span<int>::index_type>(0)};
span<int> cs{nullptr, narrow_cast<span<int>::size_type>(0)};
EXPECT_TRUE(cs.size() == 0);
EXPECT_TRUE(cs.data() == nullptr);
}
{
auto workaround_macro = []() {
const span<int, 1> s{nullptr, narrow_cast<span<int>::index_type>(0)};
const span<int, 1> s{nullptr, narrow_cast<span<int>::size_type>(0)};
};
EXPECT_DEATH(workaround_macro(), deathstring);
}
@@ -134,11 +134,11 @@ TEST(span_test, from_nullptr_size_constructor)
EXPECT_DEATH(const_workaround_macro(), deathstring);
}
{
span<int*> s{nullptr, narrow_cast<span<int>::index_type>(0)};
span<int*> s{nullptr, narrow_cast<span<int>::size_type>(0)};
EXPECT_TRUE(s.size() == 0);
EXPECT_TRUE(s.data() == nullptr);
span<const int*> cs{nullptr, narrow_cast<span<int>::index_type>(0)};
span<const int*> cs{nullptr, narrow_cast<span<int>::size_type>(0)};
EXPECT_TRUE(cs.size() == 0);
EXPECT_TRUE(cs.data() == nullptr);
}
@@ -193,7 +193,7 @@ TEST(span_test, from_pointer_length_constructor)
{
int* p = nullptr;
span<int> s{p, narrow_cast<span<int>::index_type>(0)};
span<int> s{p, narrow_cast<span<int>::size_type>(0)};
EXPECT_TRUE(s.size() == 0);
EXPECT_TRUE(s.data() == nullptr);
}
@@ -214,7 +214,7 @@ TEST(span_test, from_pointer_length_constructor)
{
int* p = nullptr;
auto s = make_span(p, narrow_cast<span<int>::index_type>(0));
auto s = make_span(p, narrow_cast<span<int>::size_type>(0));
EXPECT_TRUE(s.size() == 0);
EXPECT_TRUE(s.data() == nullptr);
}