diff options
author | Jordan Maples [MSFT] <49793787+JordanMaples@users.noreply.github.com> | 2020-01-10 03:37:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-10 03:37:12 +0300 |
commit | 2d878b94ee482029142a25fd8d96cbc6b5282140 (patch) | |
tree | cf1ac44b1767c3e571b80ea80e9e674457b0b89f /tests/span_tests.cpp | |
parent | c7f9b3301ac10f464fff0a7d2d3f5e0eb4e24b97 (diff) | |
parent | 3c0b38b777c80d94bf14630907915dae4695b019 (diff) |
Merge branch 'master' into dev/jomaples/add_missing_span_functions
Diffstat (limited to 'tests/span_tests.cpp')
-rw-r--r-- | tests/span_tests.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index ebeb685..5885328 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -1084,6 +1084,45 @@ TEST(span_test, from_array_constructor) EXPECT_TRUE(cit3 == s.cend()); } + TEST(span_test, iterator_free_functions) + { + int a[] = {1, 2, 3, 4}; + span<int> s{a}; + + EXPECT_TRUE((std::is_same<decltype(s.begin()), decltype(begin(s))>::value)); + EXPECT_TRUE((std::is_same<decltype(s.end()), decltype(end(s))>::value)); + + EXPECT_TRUE((std::is_same<decltype(s.cbegin()), decltype(cbegin(s))>::value)); + EXPECT_TRUE((std::is_same<decltype(s.cend()), decltype(cend(s))>::value)); + + EXPECT_TRUE((std::is_same<decltype(s.rbegin()), decltype(rbegin(s))>::value)); + EXPECT_TRUE((std::is_same<decltype(s.rend()), decltype(rend(s))>::value)); + + EXPECT_TRUE((std::is_same<decltype(s.crbegin()), decltype(crbegin(s))>::value)); + EXPECT_TRUE((std::is_same<decltype(s.crend()), decltype(crend(s))>::value)); + + EXPECT_TRUE(s.begin() == begin(s)); + EXPECT_TRUE(s.end() == end(s)); + + EXPECT_TRUE(s.cbegin() == cbegin(s)); + EXPECT_TRUE(s.cend() == cend(s)); + + EXPECT_TRUE(s.rbegin() == rbegin(s)); + EXPECT_TRUE(s.rend() == rend(s)); + + EXPECT_TRUE(s.crbegin() == crbegin(s)); + EXPECT_TRUE(s.crend() == crend(s)); + } + + TEST(span_test, ssize_free_function) + { + int a[] = {1, 2, 3, 4}; + span<int> s{a}; + + EXPECT_TRUE((std::is_same<decltype(s.size()), decltype(ssize(s))>::value)); + EXPECT_TRUE(s.size() == ssize(s)); + } + TEST(span_test, iterator_comparisons) { int a[] = {1, 2, 3, 4}; |