Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/GSL.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJordan Maples [MSFT] <49793787+JordanMaples@users.noreply.github.com>2020-02-06 04:12:31 +0300
committerJordan Maples [MSFT] <49793787+JordanMaples@users.noreply.github.com>2020-02-06 04:12:31 +0300
commita49ff1b8df978c1b80738cab3bb25b4140fa6424 (patch)
tree8ad1f3a3285daabf9edba3586ec6696f28a345a6 /tests
parent3b9d15f49fe043d42b2715dc5041f23ed7f56c5c (diff)
update span specialization of at, change some tests back to int i with narrowing for the comparisons.
Diffstat (limited to 'tests')
-rw-r--r--tests/span_tests.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp
index 5d9c18b..790cee0 100644
--- a/tests/span_tests.cpp
+++ b/tests/span_tests.cpp
@@ -153,24 +153,24 @@ TEST(span_test, from_pointer_length_constructor)
int arr[4] = {1, 2, 3, 4};
{
- for (std::size_t i = 0; i < 4; ++i)
+ for (int i = 0; i < 4; ++i)
{
{
- span<int> s = {&arr[0], i};
- EXPECT_TRUE(s.size() == i);
+ span<int> s = {&arr[0], narrow_cast<std::size_t>(i)};
+ EXPECT_TRUE(s.size() == narrow_cast<std::size_t>(i));
EXPECT_TRUE(s.data() == &arr[0]);
EXPECT_TRUE(s.empty() == (i == 0));
- for (std::size_t j = 0; j < i; ++j)
- EXPECT_TRUE(arr[j] == s[j]);
+ for (int j = 0; j < i; ++j)
+ EXPECT_TRUE(arr[j] == s[narrow_cast<std::size_t>(j)]);
}
{
- span<int> s = {&arr[i], 4 - i};
- EXPECT_TRUE(s.size() == 4 - i);
+ span<int> s = {&arr[i], 4 - narrow_cast<std::size_t>(i)};
+ EXPECT_TRUE(s.size() == 4 - narrow_cast<std::size_t>(i));
EXPECT_TRUE(s.data() == &arr[i]);
EXPECT_TRUE(s.empty() == ((4 - i) == 0));
- for (std::size_t j = 0; j < 4 - i; ++j)
- EXPECT_TRUE(arr[j + i] == s[j]);
+ for (int j = 0; j < 4 - i; ++j)
+ EXPECT_TRUE(arr[j + i] == s[narrow_cast<std::size_t>(j)]);
}
}
}