summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2013-08-06 17:17:13 +0000
committerMarshall Clow <mclow.lists@gmail.com>2013-08-06 17:17:13 +0000
commite141dc0490b08786aaa079a479c3d498b13f2e7b (patch)
tree01438489abea0146a1ca6c67c0ff1e50448d71b7
parent27da123d669d32c0f239a04fe706a3a175f4ebab (diff)
downloadbcm5719-llvm-e141dc0490b08786aaa079a479c3d498b13f2e7b.tar.gz
bcm5719-llvm-e141dc0490b08786aaa079a479c3d498b13f2e7b.zip
Implement tests for NULL iterators for <array> re: N3644
llvm-svn: 187809
-rw-r--r--libcxx/test/containers/sequences/array/iterators.pass.cpp79
1 files changed, 79 insertions, 0 deletions
diff --git a/libcxx/test/containers/sequences/array/iterators.pass.cpp b/libcxx/test/containers/sequences/array/iterators.pass.cpp
new file mode 100644
index 00000000000..af5e064d12c
--- /dev/null
+++ b/libcxx/test/containers/sequences/array/iterators.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// iterator, const_iterator
+
+#include <array>
+#include <iterator>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::array<int, 5> C;
+ C c;
+ C::iterator i;
+ i = c.begin();
+ C::const_iterator j;
+ j = c.cbegin();
+ assert(i == j);
+ }
+ {
+ typedef std::array<int, 0> C;
+ C c;
+ C::iterator i;
+ i = c.begin();
+ C::const_iterator j;
+ j = c.cbegin();
+ assert(i == j);
+ }
+
+#if _LIBCPP_STD_VER > 11
+ { // N3664 testing
+ {
+ typedef std::array<int, 5> C;
+ C::iterator ii1{}, ii2{};
+ C::iterator ii4 = ii1;
+ C::const_iterator cii{};
+ assert ( ii1 == ii2 );
+ assert ( ii1 == ii4 );
+ assert ( ii1 == cii );
+
+ assert ( !(ii1 != ii2 ));
+ assert ( !(ii1 != cii ));
+
+// C c;
+// assert ( ii1 != c.cbegin());
+// assert ( cii != c.begin());
+// assert ( cii != c.cend());
+// assert ( ii1 != c.end());
+ }
+ {
+ typedef std::array<int, 0> C;
+ C::iterator ii1{}, ii2{};
+ C::iterator ii4 = ii1;
+ C::const_iterator cii{};
+ assert ( ii1 == ii2 );
+ assert ( ii1 == ii4 );
+ assert ( ii1 == cii );
+
+ assert ( !(ii1 != ii2 ));
+ assert ( !(ii1 != cii ));
+
+// C c;
+// assert ( ii1 != c.cbegin());
+// assert ( cii != c.begin());
+// assert ( cii != c.cend());
+// assert ( ii1 != c.end());
+ }
+ }
+#endif
+}
OpenPOWER on IntegriCloud