summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/iterators/iterator.container
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2018-01-30 00:47:43 +0000
committerMarshall Clow <mclow.lists@gmail.com>2018-01-30 00:47:43 +0000
commitaafb3151a8f2343aeef5594d7beb2cd817699677 (patch)
treebb3eab7ba661d99b42b19cd2d29ef6aa2f9e69f9 /libcxx/test/std/iterators/iterator.container
parentee4e2e718d00a44c9ac4e663534a0391d72a3549 (diff)
downloadbcm5719-llvm-aafb3151a8f2343aeef5594d7beb2cd817699677.tar.gz
bcm5719-llvm-aafb3151a8f2343aeef5594d7beb2cd817699677.zip
Add tests to make sure that <string_view> provides std::size/data/empty in C++17 mode. This is LWG#3009, coming up for a vote in JAX - but we already do it, just don't have tests
llvm-svn: 323719
Diffstat (limited to 'libcxx/test/std/iterators/iterator.container')
-rw-r--r--libcxx/test/std/iterators/iterator.container/data.pass.cpp10
-rw-r--r--libcxx/test/std/iterators/iterator.container/empty.pass.cpp10
-rw-r--r--libcxx/test/std/iterators/iterator.container/size.pass.cpp12
3 files changed, 31 insertions, 1 deletions
diff --git a/libcxx/test/std/iterators/iterator.container/data.pass.cpp b/libcxx/test/std/iterators/iterator.container/data.pass.cpp
index 09b7c013496..12ca9129526 100644
--- a/libcxx/test/std/iterators/iterator.container/data.pass.cpp
+++ b/libcxx/test/std/iterators/iterator.container/data.pass.cpp
@@ -23,6 +23,10 @@
#include "test_macros.h"
+#if TEST_STD_VER > 14
+#include <string_view>
+#endif
+
template<typename C>
void test_const_container( const C& c )
{
@@ -72,6 +76,12 @@ int main()
test_const_container ( a );
test_const_container ( il );
+#if TEST_STD_VER > 14
+ std::string_view sv{"ABC"};
+ test_container ( sv );
+ test_const_container ( sv );
+#endif
+
static constexpr int arrA [] { 1, 2, 3 };
test_const_array ( arrA );
}
diff --git a/libcxx/test/std/iterators/iterator.container/empty.pass.cpp b/libcxx/test/std/iterators/iterator.container/empty.pass.cpp
index cd000cc2fe7..f6fe2351d3c 100644
--- a/libcxx/test/std/iterators/iterator.container/empty.pass.cpp
+++ b/libcxx/test/std/iterators/iterator.container/empty.pass.cpp
@@ -23,6 +23,10 @@
#include "test_macros.h"
+#if TEST_STD_VER > 14
+#include <string_view>
+#endif
+
template<typename C>
void test_const_container( const C& c )
{
@@ -74,6 +78,12 @@ int main()
test_const_container ( a );
test_const_container ( il );
+#if TEST_STD_VER > 14
+ std::string_view sv{"ABC"};
+ test_container ( sv );
+ test_const_container ( sv );
+#endif
+
static constexpr int arrA [] { 1, 2, 3 };
test_const_array ( arrA );
}
diff --git a/libcxx/test/std/iterators/iterator.container/size.pass.cpp b/libcxx/test/std/iterators/iterator.container/size.pass.cpp
index 7d443e6e123..6d3bc512891 100644
--- a/libcxx/test/std/iterators/iterator.container/size.pass.cpp
+++ b/libcxx/test/std/iterators/iterator.container/size.pass.cpp
@@ -22,6 +22,11 @@
#include "test_macros.h"
+#if TEST_STD_VER > 14
+#include <string_view>
+#endif
+
+
template<typename C>
void test_const_container( const C& c )
{
@@ -65,7 +70,6 @@ int main()
std::list<int> l; l.push_back(2);
std::array<int, 1> a; a[0] = 3;
std::initializer_list<int> il = { 4 };
-
test_container ( v );
test_container ( l );
test_container ( a );
@@ -76,6 +80,12 @@ int main()
test_const_container ( a );
test_const_container ( il );
+#if TEST_STD_VER > 14
+ std::string_view sv{"ABC"};
+ test_container ( sv );
+ test_const_container ( sv );
+#endif
+
static constexpr int arrA [] { 1, 2, 3 };
test_const_array ( arrA );
}
OpenPOWER on IntegriCloud