aboutsummaryrefslogtreecommitdiff
path: root/test/std/containers/sequences/forwardlist/forwardlist.modifiers
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/containers/sequences/forwardlist/forwardlist.modifiers')
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp62
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp89
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp50
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_many.pass.cpp155
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_one.pass.cpp97
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_const.pass.cpp87
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp75
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp80
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp90
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp73
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp78
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_const.pass.cpp47
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp73
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp50
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size.pass.cpp114
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp84
16 files changed, 1304 insertions, 0 deletions
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp
new file mode 100644
index 000000000000..2739b49d8eb2
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void clear();
+
+#include <forward_list>
+#include <cassert>
+
+#include "../../../NotConstructible.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef NotConstructible T;
+ typedef std::forward_list<T> C;
+ C c;
+ c.clear();
+ assert(distance(c.begin(), c.end()) == 0);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t[] = {0, 1, 2, 3, 4};
+ C c(std::begin(t), std::end(t));
+
+ c.clear();
+ assert(distance(c.begin(), c.end()) == 0);
+
+ c.clear();
+ assert(distance(c.begin(), c.end()) == 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef NotConstructible T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c;
+ c.clear();
+ assert(distance(c.begin(), c.end()) == 0);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t[] = {0, 1, 2, 3, 4};
+ C c(std::begin(t), std::end(t));
+
+ c.clear();
+ assert(distance(c.begin(), c.end()) == 0);
+
+ c.clear();
+ assert(distance(c.begin(), c.end()) == 0);
+ }
+#endif
+}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp
new file mode 100644
index 000000000000..e305c5b6ab52
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp
@@ -0,0 +1,89 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// template <class... Args>
+// iterator emplace_after(const_iterator p, Args&&... args);
+
+#include <forward_list>
+#include <cassert>
+
+#include "../../../Emplaceable.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef Emplaceable T;
+ typedef std::forward_list<T> C;
+ typedef C::iterator I;
+ C c;
+ I i = c.emplace_after(c.cbefore_begin());
+ assert(i == c.begin());
+ assert(c.front() == Emplaceable());
+ assert(distance(c.begin(), c.end()) == 1);
+
+ i = c.emplace_after(c.cbegin(), 1, 2.5);
+ assert(i == next(c.begin()));
+ assert(c.front() == Emplaceable());
+ assert(*next(c.begin()) == Emplaceable(1, 2.5));
+ assert(distance(c.begin(), c.end()) == 2);
+
+ i = c.emplace_after(next(c.cbegin()), 2, 3.5);
+ assert(i == next(c.begin(), 2));
+ assert(c.front() == Emplaceable());
+ assert(*next(c.begin()) == Emplaceable(1, 2.5));
+ assert(*next(c.begin(), 2) == Emplaceable(2, 3.5));
+ assert(distance(c.begin(), c.end()) == 3);
+
+ i = c.emplace_after(c.cbegin(), 3, 4.5);
+ assert(i == next(c.begin()));
+ assert(c.front() == Emplaceable());
+ assert(*next(c.begin(), 1) == Emplaceable(3, 4.5));
+ assert(*next(c.begin(), 2) == Emplaceable(1, 2.5));
+ assert(*next(c.begin(), 3) == Emplaceable(2, 3.5));
+ assert(distance(c.begin(), c.end()) == 4);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef Emplaceable T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ typedef C::iterator I;
+ C c;
+ I i = c.emplace_after(c.cbefore_begin());
+ assert(i == c.begin());
+ assert(c.front() == Emplaceable());
+ assert(distance(c.begin(), c.end()) == 1);
+
+ i = c.emplace_after(c.cbegin(), 1, 2.5);
+ assert(i == next(c.begin()));
+ assert(c.front() == Emplaceable());
+ assert(*next(c.begin()) == Emplaceable(1, 2.5));
+ assert(distance(c.begin(), c.end()) == 2);
+
+ i = c.emplace_after(next(c.cbegin()), 2, 3.5);
+ assert(i == next(c.begin(), 2));
+ assert(c.front() == Emplaceable());
+ assert(*next(c.begin()) == Emplaceable(1, 2.5));
+ assert(*next(c.begin(), 2) == Emplaceable(2, 3.5));
+ assert(distance(c.begin(), c.end()) == 3);
+
+ i = c.emplace_after(c.cbegin(), 3, 4.5);
+ assert(i == next(c.begin()));
+ assert(c.front() == Emplaceable());
+ assert(*next(c.begin(), 1) == Emplaceable(3, 4.5));
+ assert(*next(c.begin(), 2) == Emplaceable(1, 2.5));
+ assert(*next(c.begin(), 3) == Emplaceable(2, 3.5));
+ assert(distance(c.begin(), c.end()) == 4);
+ }
+#endif
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp
new file mode 100644
index 000000000000..c02337e0562d
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// template <class... Args> void emplace_front(Args&&... args);
+
+#include <forward_list>
+#include <cassert>
+
+#include "../../../Emplaceable.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef Emplaceable T;
+ typedef std::forward_list<T> C;
+ C c;
+ c.emplace_front();
+ assert(c.front() == Emplaceable());
+ assert(distance(c.begin(), c.end()) == 1);
+ c.emplace_front(1, 2.5);
+ assert(c.front() == Emplaceable(1, 2.5));
+ assert(*next(c.begin()) == Emplaceable());
+ assert(distance(c.begin(), c.end()) == 2);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef Emplaceable T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c;
+ c.emplace_front();
+ assert(c.front() == Emplaceable());
+ assert(distance(c.begin(), c.end()) == 1);
+ c.emplace_front(1, 2.5);
+ assert(c.front() == Emplaceable(1, 2.5));
+ assert(*next(c.begin()) == Emplaceable());
+ assert(distance(c.begin(), c.end()) == 2);
+ }
+#endif
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_many.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_many.pass.cpp
new file mode 100644
index 000000000000..bd9b15300efa
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_many.pass.cpp
@@ -0,0 +1,155 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// iterator erase_after(const_iterator first, const_iterator last);
+
+#include <forward_list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t), std::end(t));
+
+ C::iterator i = c.erase_after(next(c.cbefore_begin(), 4), next(c.cbefore_begin(), 4));
+ assert(i == next(c.cbefore_begin(), 4));
+ assert(distance(c.begin(), c.end()) == 10);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 2);
+ assert(*next(c.begin(), 3) == 3);
+ assert(*next(c.begin(), 4) == 4);
+ assert(*next(c.begin(), 5) == 5);
+ assert(*next(c.begin(), 6) == 6);
+ assert(*next(c.begin(), 7) == 7);
+ assert(*next(c.begin(), 8) == 8);
+ assert(*next(c.begin(), 9) == 9);
+
+ i = c.erase_after(next(c.cbefore_begin(), 2), next(c.cbefore_begin(), 5));
+ assert(i == next(c.begin(), 2));
+ assert(distance(c.begin(), c.end()) == 8);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 4);
+ assert(*next(c.begin(), 3) == 5);
+ assert(*next(c.begin(), 4) == 6);
+ assert(*next(c.begin(), 5) == 7);
+ assert(*next(c.begin(), 6) == 8);
+ assert(*next(c.begin(), 7) == 9);
+
+ i = c.erase_after(next(c.cbefore_begin(), 2), next(c.cbefore_begin(), 3));
+ assert(i == next(c.begin(), 2));
+ assert(distance(c.begin(), c.end()) == 8);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 4);
+ assert(*next(c.begin(), 3) == 5);
+ assert(*next(c.begin(), 4) == 6);
+ assert(*next(c.begin(), 5) == 7);
+ assert(*next(c.begin(), 6) == 8);
+ assert(*next(c.begin(), 7) == 9);
+
+ i = c.erase_after(next(c.cbefore_begin(), 5), next(c.cbefore_begin(), 9));
+ assert(i == c.end());
+ assert(distance(c.begin(), c.end()) == 5);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 4);
+ assert(*next(c.begin(), 3) == 5);
+ assert(*next(c.begin(), 4) == 6);
+
+ i = c.erase_after(next(c.cbefore_begin(), 0), next(c.cbefore_begin(), 2));
+ assert(i == c.begin());
+ assert(distance(c.begin(), c.end()) == 4);
+ assert(*next(c.begin(), 0) == 1);
+ assert(*next(c.begin(), 1) == 4);
+ assert(*next(c.begin(), 2) == 5);
+ assert(*next(c.begin(), 3) == 6);
+
+ i = c.erase_after(next(c.cbefore_begin(), 0), next(c.cbefore_begin(), 5));
+ assert(i == c.begin());
+ assert(i == c.end());
+ assert(distance(c.begin(), c.end()) == 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t), std::end(t));
+
+ C::iterator i = c.erase_after(next(c.cbefore_begin(), 4), next(c.cbefore_begin(), 4));
+ assert(i == next(c.cbefore_begin(), 4));
+ assert(distance(c.begin(), c.end()) == 10);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 2);
+ assert(*next(c.begin(), 3) == 3);
+ assert(*next(c.begin(), 4) == 4);
+ assert(*next(c.begin(), 5) == 5);
+ assert(*next(c.begin(), 6) == 6);
+ assert(*next(c.begin(), 7) == 7);
+ assert(*next(c.begin(), 8) == 8);
+ assert(*next(c.begin(), 9) == 9);
+
+ i = c.erase_after(next(c.cbefore_begin(), 2), next(c.cbefore_begin(), 5));
+ assert(i == next(c.begin(), 2));
+ assert(distance(c.begin(), c.end()) == 8);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 4);
+ assert(*next(c.begin(), 3) == 5);
+ assert(*next(c.begin(), 4) == 6);
+ assert(*next(c.begin(), 5) == 7);
+ assert(*next(c.begin(), 6) == 8);
+ assert(*next(c.begin(), 7) == 9);
+
+ i = c.erase_after(next(c.cbefore_begin(), 2), next(c.cbefore_begin(), 3));
+ assert(i == next(c.begin(), 2));
+ assert(distance(c.begin(), c.end()) == 8);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 4);
+ assert(*next(c.begin(), 3) == 5);
+ assert(*next(c.begin(), 4) == 6);
+ assert(*next(c.begin(), 5) == 7);
+ assert(*next(c.begin(), 6) == 8);
+ assert(*next(c.begin(), 7) == 9);
+
+ i = c.erase_after(next(c.cbefore_begin(), 5), next(c.cbefore_begin(), 9));
+ assert(i == c.end());
+ assert(distance(c.begin(), c.end()) == 5);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 4);
+ assert(*next(c.begin(), 3) == 5);
+ assert(*next(c.begin(), 4) == 6);
+
+ i = c.erase_after(next(c.cbefore_begin(), 0), next(c.cbefore_begin(), 2));
+ assert(i == c.begin());
+ assert(distance(c.begin(), c.end()) == 4);
+ assert(*next(c.begin(), 0) == 1);
+ assert(*next(c.begin(), 1) == 4);
+ assert(*next(c.begin(), 2) == 5);
+ assert(*next(c.begin(), 3) == 6);
+
+ i = c.erase_after(next(c.cbefore_begin(), 0), next(c.cbefore_begin(), 5));
+ assert(i == c.begin());
+ assert(i == c.end());
+ assert(distance(c.begin(), c.end()) == 0);
+ }
+#endif
+}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_one.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_one.pass.cpp
new file mode 100644
index 000000000000..4f51498bc651
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_one.pass.cpp
@@ -0,0 +1,97 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// iterator erase_after(const_iterator p);
+
+#include <forward_list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t[] = {0, 1, 2, 3, 4};
+ C c(std::begin(t), std::end(t));
+
+ C::iterator i = c.erase_after(next(c.cbefore_begin(), 4));
+ assert(i == c.end());
+ assert(distance(c.begin(), c.end()) == 4);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 2);
+ assert(*next(c.begin(), 3) == 3);
+
+ i = c.erase_after(next(c.cbefore_begin(), 0));
+ assert(i == c.begin());
+ assert(distance(c.begin(), c.end()) == 3);
+ assert(*next(c.begin(), 0) == 1);
+ assert(*next(c.begin(), 1) == 2);
+ assert(*next(c.begin(), 2) == 3);
+
+ i = c.erase_after(next(c.cbefore_begin(), 1));
+ assert(i == next(c.begin()));
+ assert(distance(c.begin(), c.end()) == 2);
+ assert(*next(c.begin(), 0) == 1);
+ assert(*next(c.begin(), 1) == 3);
+
+ i = c.erase_after(next(c.cbefore_begin(), 1));
+ assert(i == c.end());
+ assert(distance(c.begin(), c.end()) == 1);
+ assert(*next(c.begin(), 0) == 1);
+
+ i = c.erase_after(next(c.cbefore_begin(), 0));
+ assert(i == c.begin());
+ assert(i == c.end());
+ assert(distance(c.begin(), c.end()) == 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t[] = {0, 1, 2, 3, 4};
+ C c(std::begin(t), std::end(t));
+
+ C::iterator i = c.erase_after(next(c.cbefore_begin(), 4));
+ assert(i == c.end());
+ assert(distance(c.begin(), c.end()) == 4);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 2);
+ assert(*next(c.begin(), 3) == 3);
+
+ i = c.erase_after(next(c.cbefore_begin(), 0));
+ assert(i == c.begin());
+ assert(distance(c.begin(), c.end()) == 3);
+ assert(*next(c.begin(), 0) == 1);
+ assert(*next(c.begin(), 1) == 2);
+ assert(*next(c.begin(), 2) == 3);
+
+ i = c.erase_after(next(c.cbefore_begin(), 1));
+ assert(i == next(c.begin()));
+ assert(distance(c.begin(), c.end()) == 2);
+ assert(*next(c.begin(), 0) == 1);
+ assert(*next(c.begin(), 1) == 3);
+
+ i = c.erase_after(next(c.cbefore_begin(), 1));
+ assert(i == c.end());
+ assert(distance(c.begin(), c.end()) == 1);
+ assert(*next(c.begin(), 0) == 1);
+
+ i = c.erase_after(next(c.cbefore_begin(), 0));
+ assert(i == c.begin());
+ assert(i == c.end());
+ assert(distance(c.begin(), c.end()) == 0);
+ }
+#endif
+}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_const.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_const.pass.cpp
new file mode 100644
index 000000000000..ec650b695727
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_const.pass.cpp
@@ -0,0 +1,87 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// iterator insert_after(const_iterator p, const value_type& v);
+
+#include <forward_list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ typedef C::iterator I;
+ C c;
+ I i = c.insert_after(c.cbefore_begin(), 0);
+ assert(i == c.begin());
+ assert(c.front() == 0);
+ assert(c.front() == 0);
+ assert(distance(c.begin(), c.end()) == 1);
+
+ i = c.insert_after(c.cbegin(), 1);
+ assert(i == next(c.begin()));
+ assert(c.front() == 0);
+ assert(*next(c.begin()) == 1);
+ assert(distance(c.begin(), c.end()) == 2);
+
+ i = c.insert_after(next(c.cbegin()), 2);
+ assert(i == next(c.begin(), 2));
+ assert(c.front() == 0);
+ assert(*next(c.begin()) == 1);
+ assert(*next(c.begin(), 2) == 2);
+ assert(distance(c.begin(), c.end()) == 3);
+
+ i = c.insert_after(c.cbegin(), 3);
+ assert(i == next(c.begin()));
+ assert(c.front() == 0);
+ assert(*next(c.begin(), 1) == 3);
+ assert(*next(c.begin(), 2) == 1);
+ assert(*next(c.begin(), 3) == 2);
+ assert(distance(c.begin(), c.end()) == 4);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ typedef C::iterator I;
+ C c;
+ I i = c.insert_after(c.cbefore_begin(), 0);
+ assert(i == c.begin());
+ assert(c.front() == 0);
+ assert(c.front() == 0);
+ assert(distance(c.begin(), c.end()) == 1);
+
+ i = c.insert_after(c.cbegin(), 1);
+ assert(i == next(c.begin()));
+ assert(c.front() == 0);
+ assert(*next(c.begin()) == 1);
+ assert(distance(c.begin(), c.end()) == 2);
+
+ i = c.insert_after(next(c.cbegin()), 2);
+ assert(i == next(c.begin(), 2));
+ assert(c.front() == 0);
+ assert(*next(c.begin()) == 1);
+ assert(*next(c.begin(), 2) == 2);
+ assert(distance(c.begin(), c.end()) == 3);
+
+ i = c.insert_after(c.cbegin(), 3);
+ assert(i == next(c.begin()));
+ assert(c.front() == 0);
+ assert(*next(c.begin(), 1) == 3);
+ assert(*next(c.begin(), 2) == 1);
+ assert(*next(c.begin(), 3) == 2);
+ assert(distance(c.begin(), c.end()) == 4);
+ }
+#endif
+}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp
new file mode 100644
index 000000000000..4d3018199809
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp
@@ -0,0 +1,75 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// iterator insert_after(const_iterator p, initializer_list<value_type> il);
+
+#include <forward_list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ typedef C::iterator I;
+ C c;
+ I i = c.insert_after(c.cbefore_begin(), {});
+ assert(i == c.before_begin());
+ assert(distance(c.begin(), c.end()) == 0);
+
+ i = c.insert_after(c.cbefore_begin(), {0, 1, 2});
+ assert(i == next(c.before_begin(), 3));
+ assert(distance(c.begin(), c.end()) == 3);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 2);
+
+ i = c.insert_after(c.begin(), {3, 4});
+ assert(i == next(c.begin(), 2));
+ assert(distance(c.begin(), c.end()) == 5);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 3);
+ assert(*next(c.begin(), 2) == 4);
+ assert(*next(c.begin(), 3) == 1);
+ assert(*next(c.begin(), 4) == 2);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ typedef C::iterator I;
+ C c;
+ I i = c.insert_after(c.cbefore_begin(), {});
+ assert(i == c.before_begin());
+ assert(distance(c.begin(), c.end()) == 0);
+
+ i = c.insert_after(c.cbefore_begin(), {0, 1, 2});
+ assert(i == next(c.before_begin(), 3));
+ assert(distance(c.begin(), c.end()) == 3);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 2);
+
+ i = c.insert_after(c.begin(), {3, 4});
+ assert(i == next(c.begin(), 2));
+ assert(distance(c.begin(), c.end()) == 5);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 3);
+ assert(*next(c.begin(), 2) == 4);
+ assert(*next(c.begin(), 3) == 1);
+ assert(*next(c.begin(), 4) == 2);
+ }
+#endif
+#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp
new file mode 100644
index 000000000000..103475f1edab
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// template <class InputIterator>
+// iterator insert_after(const_iterator p,
+// InputIterator first, InputIterator last);
+
+#include <forward_list>
+#include <cassert>
+
+#include "test_iterators.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ typedef C::iterator I;
+ typedef input_iterator<const T*> J;
+ C c;
+ const T t[] = {0, 1, 2, 3, 4};
+ I i = c.insert_after(c.cbefore_begin(), J(t), J(t));
+ assert(i == c.before_begin());
+ assert(distance(c.begin(), c.end()) == 0);
+
+ i = c.insert_after(c.cbefore_begin(), J(t), J(t+3));
+ assert(i == next(c.before_begin(), 3));
+ assert(distance(c.begin(), c.end()) == 3);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 2);
+
+ i = c.insert_after(c.begin(), J(t+3), J(t+5));
+ assert(i == next(c.begin(), 2));
+ assert(distance(c.begin(), c.end()) == 5);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 3);
+ assert(*next(c.begin(), 2) == 4);
+ assert(*next(c.begin(), 3) == 1);
+ assert(*next(c.begin(), 4) == 2);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ typedef C::iterator I;
+ typedef input_iterator<const T*> J;
+ C c;
+ const T t[] = {0, 1, 2, 3, 4};
+ I i = c.insert_after(c.cbefore_begin(), J(t), J(t));
+ assert(i == c.before_begin());
+ assert(distance(c.begin(), c.end()) == 0);
+
+ i = c.insert_after(c.cbefore_begin(), J(t), J(t+3));
+ assert(i == next(c.before_begin(), 3));
+ assert(distance(c.begin(), c.end()) == 3);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 2);
+
+ i = c.insert_after(c.begin(), J(t+3), J(t+5));
+ assert(i == next(c.begin(), 2));
+ assert(distance(c.begin(), c.end()) == 5);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 3);
+ assert(*next(c.begin(), 2) == 4);
+ assert(*next(c.begin(), 3) == 1);
+ assert(*next(c.begin(), 4) == 2);
+ }
+#endif
+}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp
new file mode 100644
index 000000000000..f7f376caa090
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp
@@ -0,0 +1,90 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// iterator insert_after(const_iterator p, value_type&& v);
+
+#include <forward_list>
+#include <cassert>
+
+#include "MoveOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef MoveOnly T;
+ typedef std::forward_list<T> C;
+ typedef C::iterator I;
+ C c;
+ I i = c.insert_after(c.cbefore_begin(), 0);
+ assert(i == c.begin());
+ assert(c.front() == 0);
+ assert(c.front() == 0);
+ assert(distance(c.begin(), c.end()) == 1);
+
+ i = c.insert_after(c.cbegin(), 1);
+ assert(i == next(c.begin()));
+ assert(c.front() == 0);
+ assert(*next(c.begin()) == 1);
+ assert(distance(c.begin(), c.end()) == 2);
+
+ i = c.insert_after(next(c.cbegin()), 2);
+ assert(i == next(c.begin(), 2));
+ assert(c.front() == 0);
+ assert(*next(c.begin()) == 1);
+ assert(*next(c.begin(), 2) == 2);
+ assert(distance(c.begin(), c.end()) == 3);
+
+ i = c.insert_after(c.cbegin(), 3);
+ assert(i == next(c.begin()));
+ assert(c.front() == 0);
+ assert(*next(c.begin(), 1) == 3);
+ assert(*next(c.begin(), 2) == 1);
+ assert(*next(c.begin(), 3) == 2);
+ assert(distance(c.begin(), c.end()) == 4);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef MoveOnly T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ typedef C::iterator I;
+ C c;
+ I i = c.insert_after(c.cbefore_begin(), 0);
+ assert(i == c.begin());
+ assert(c.front() == 0);
+ assert(c.front() == 0);
+ assert(distance(c.begin(), c.end()) == 1);
+
+ i = c.insert_after(c.cbegin(), 1);
+ assert(i == next(c.begin()));
+ assert(c.front() == 0);
+ assert(*next(c.begin()) == 1);
+ assert(distance(c.begin(), c.end()) == 2);
+
+ i = c.insert_after(next(c.cbegin()), 2);
+ assert(i == next(c.begin(), 2));
+ assert(c.front() == 0);
+ assert(*next(c.begin()) == 1);
+ assert(*next(c.begin(), 2) == 2);
+ assert(distance(c.begin(), c.end()) == 3);
+
+ i = c.insert_after(c.cbegin(), 3);
+ assert(i == next(c.begin()));
+ assert(c.front() == 0);
+ assert(*next(c.begin(), 1) == 3);
+ assert(*next(c.begin(), 2) == 1);
+ assert(*next(c.begin(), 3) == 2);
+ assert(distance(c.begin(), c.end()) == 4);
+ }
+#endif
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp
new file mode 100644
index 000000000000..b2da2ecd3bbd
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// iterator insert_after(const_iterator p, size_type n, const value_type& v);
+
+#include <forward_list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ typedef C::iterator I;
+ C c;
+ I i = c.insert_after(c.cbefore_begin(), 0, 0);
+ assert(i == c.before_begin());
+ assert(distance(c.begin(), c.end()) == 0);
+
+ i = c.insert_after(c.cbefore_begin(), 3, 3);
+ assert(i == next(c.before_begin(), 3));
+ assert(distance(c.begin(), c.end()) == 3);
+ assert(*next(c.begin(), 0) == 3);
+ assert(*next(c.begin(), 1) == 3);
+ assert(*next(c.begin(), 2) == 3);
+
+ i = c.insert_after(c.begin(), 2, 2);
+ assert(i == next(c.begin(), 2));
+ assert(distance(c.begin(), c.end()) == 5);
+ assert(*next(c.begin(), 0) == 3);
+ assert(*next(c.begin(), 1) == 2);
+ assert(*next(c.begin(), 2) == 2);
+ assert(*next(c.begin(), 3) == 3);
+ assert(*next(c.begin(), 4) == 3);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ typedef C::iterator I;
+ C c;
+ I i = c.insert_after(c.cbefore_begin(), 0, 0);
+ assert(i == c.before_begin());
+ assert(distance(c.begin(), c.end()) == 0);
+
+ i = c.insert_after(c.cbefore_begin(), 3, 3);
+ assert(i == next(c.before_begin(), 3));
+ assert(distance(c.begin(), c.end()) == 3);
+ assert(*next(c.begin(), 0) == 3);
+ assert(*next(c.begin(), 1) == 3);
+ assert(*next(c.begin(), 2) == 3);
+
+ i = c.insert_after(c.begin(), 2, 2);
+ assert(i == next(c.begin(), 2));
+ assert(distance(c.begin(), c.end()) == 5);
+ assert(*next(c.begin(), 0) == 3);
+ assert(*next(c.begin(), 1) == 2);
+ assert(*next(c.begin(), 2) == 2);
+ assert(*next(c.begin(), 3) == 3);
+ assert(*next(c.begin(), 4) == 3);
+ }
+#endif
+}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp
new file mode 100644
index 000000000000..7f14e54a2e6f
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void pop_front();
+
+#include <forward_list>
+#include <cassert>
+
+#include "MoveOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ typedef std::forward_list<T> C;
+ C c;
+ c.push_front(1);
+ c.push_front(3);
+ c.pop_front();
+ assert(distance(c.begin(), c.end()) == 1);
+ assert(c.front() == 1);
+ c.pop_front();
+ assert(distance(c.begin(), c.end()) == 0);
+ }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef MoveOnly T;
+ typedef std::forward_list<T> C;
+ C c;
+ c.push_front(1);
+ c.push_front(3);
+ c.pop_front();
+ assert(distance(c.begin(), c.end()) == 1);
+ assert(c.front() == 1);
+ c.pop_front();
+ assert(distance(c.begin(), c.end()) == 0);
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c;
+ c.push_front(1);
+ c.push_front(3);
+ c.pop_front();
+ assert(distance(c.begin(), c.end()) == 1);
+ assert(c.front() == 1);
+ c.pop_front();
+ assert(distance(c.begin(), c.end()) == 0);
+ }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef MoveOnly T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c;
+ c.push_front(1);
+ c.push_front(3);
+ c.pop_front();
+ assert(distance(c.begin(), c.end()) == 1);
+ assert(c.front() == 1);
+ c.pop_front();
+ assert(distance(c.begin(), c.end()) == 0);
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
+}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_const.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_const.pass.cpp
new file mode 100644
index 000000000000..85958afc1ce3
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_const.pass.cpp
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void push_front(const value_type& v);
+
+#include <forward_list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ C c;
+ c.push_front(1);
+ assert(c.front() == 1);
+ assert(distance(c.begin(), c.end()) == 1);
+ c.push_front(3);
+ assert(c.front() == 3);
+ assert(*next(c.begin()) == 1);
+ assert(distance(c.begin(), c.end()) == 2);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c;
+ c.push_front(1);
+ assert(c.front() == 1);
+ assert(distance(c.begin(), c.end()) == 1);
+ c.push_front(3);
+ assert(c.front() == 3);
+ assert(*next(c.begin()) == 1);
+ assert(distance(c.begin(), c.end()) == 2);
+ }
+#endif
+}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp
new file mode 100644
index 000000000000..43c62eb00cbf
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void push_front(const value_type& x);
+
+#include <forward_list>
+#include <cassert>
+
+// Flag that makes the copy constructor for CMyClass throw an exception
+static bool gCopyConstructorShouldThow = false;
+
+
+class CMyClass {
+ public: CMyClass();
+ public: CMyClass(const CMyClass& iOther);
+ public: ~CMyClass();
+
+ private: int fMagicValue;
+
+ private: static int kStartedConstructionMagicValue;
+ private: static int kFinishedConstructionMagicValue;
+};
+
+// Value for fMagicValue when the constructor has started running, but not yet finished
+int CMyClass::kStartedConstructionMagicValue = 0;
+// Value for fMagicValue when the constructor has finished running
+int CMyClass::kFinishedConstructionMagicValue = 12345;
+
+CMyClass::CMyClass() :
+ fMagicValue(kStartedConstructionMagicValue)
+{
+ // Signal that the constructor has finished running
+ fMagicValue = kFinishedConstructionMagicValue;
+}
+
+CMyClass::CMyClass(const CMyClass& /*iOther*/) :
+ fMagicValue(kStartedConstructionMagicValue)
+{
+ // If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
+ if (gCopyConstructorShouldThow) {
+ throw std::exception();
+ }
+ // Signal that the constructor has finished running
+ fMagicValue = kFinishedConstructionMagicValue;
+}
+
+CMyClass::~CMyClass() {
+ // Only instances for which the constructor has finished running should be destructed
+ assert(fMagicValue == kFinishedConstructionMagicValue);
+}
+
+int main()
+{
+ CMyClass instance;
+ std::forward_list<CMyClass> vec;
+
+ vec.push_front(instance);
+
+ gCopyConstructorShouldThow = true;
+ try {
+ vec.push_front(instance);
+ }
+ catch (...) {
+ }
+}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp
new file mode 100644
index 000000000000..d7c9d758aa03
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void push_front(value_type&& v);
+
+#include <forward_list>
+#include <cassert>
+
+#include "MoveOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef MoveOnly T;
+ typedef std::forward_list<T> C;
+ C c;
+ c.push_front(1);
+ assert(c.front() == 1);
+ assert(distance(c.begin(), c.end()) == 1);
+ c.push_front(3);
+ assert(c.front() == 3);
+ assert(*next(c.begin()) == 1);
+ assert(distance(c.begin(), c.end()) == 2);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef MoveOnly T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c;
+ c.push_front(1);
+ assert(c.front() == 1);
+ assert(distance(c.begin(), c.end()) == 1);
+ c.push_front(3);
+ assert(c.front() == 3);
+ assert(*next(c.begin()) == 1);
+ assert(distance(c.begin(), c.end()) == 2);
+ }
+#endif
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size.pass.cpp
new file mode 100644
index 000000000000..ef7ef82626dc
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size.pass.cpp
@@ -0,0 +1,114 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void resize(size_type n);
+
+#include <forward_list>
+#include <cassert>
+
+#include "DefaultOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef DefaultOnly T;
+ typedef std::forward_list<T> C;
+ C c;
+ c.resize(0);
+ assert(distance(c.begin(), c.end()) == 0);
+ c.resize(10);
+ assert(distance(c.begin(), c.end()) == 10);
+ c.resize(20);
+ assert(distance(c.begin(), c.end()) == 20);
+ c.resize(5);
+ assert(distance(c.begin(), c.end()) == 5);
+ c.resize(0);
+ assert(distance(c.begin(), c.end()) == 0);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t[] = {0, 1, 2, 3, 4};
+ C c(std::begin(t), std::end(t));
+
+ c.resize(3);
+ assert(distance(c.begin(), c.end()) == 3);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 2);
+
+ c.resize(6);
+ assert(distance(c.begin(), c.end()) == 6);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 2);
+ assert(*next(c.begin(), 3) == 0);
+ assert(*next(c.begin(), 4) == 0);
+ assert(*next(c.begin(), 5) == 0);
+
+ c.resize(6);
+ assert(distance(c.begin(), c.end()) == 6);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 2);
+ assert(*next(c.begin(), 3) == 0);
+ assert(*next(c.begin(), 4) == 0);
+ assert(*next(c.begin(), 5) == 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef DefaultOnly T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c;
+ c.resize(0);
+ assert(distance(c.begin(), c.end()) == 0);
+ c.resize(10);
+ assert(distance(c.begin(), c.end()) == 10);
+ c.resize(20);
+ assert(distance(c.begin(), c.end()) == 20);
+ c.resize(5);
+ assert(distance(c.begin(), c.end()) == 5);
+ c.resize(0);
+ assert(distance(c.begin(), c.end()) == 0);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t[] = {0, 1, 2, 3, 4};
+ C c(std::begin(t), std::end(t));
+
+ c.resize(3);
+ assert(distance(c.begin(), c.end()) == 3);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 2);
+
+ c.resize(6);
+ assert(distance(c.begin(), c.end()) == 6);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 2);
+ assert(*next(c.begin(), 3) == 0);
+ assert(*next(c.begin(), 4) == 0);
+ assert(*next(c.begin(), 5) == 0);
+
+ c.resize(6);
+ assert(distance(c.begin(), c.end()) == 6);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 2);
+ assert(*next(c.begin(), 3) == 0);
+ assert(*next(c.begin(), 4) == 0);
+ assert(*next(c.begin(), 5) == 0);
+ }
+#endif
+}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp
new file mode 100644
index 000000000000..d4bd6b4e0111
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void resize(size_type n, const value_type& v);
+
+#include <forward_list>
+#include <cassert>
+
+#include "DefaultOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t[] = {0, 1, 2, 3, 4};
+ C c(std::begin(t), std::end(t));
+
+ c.resize(3, 10);
+ assert(distance(c.begin(), c.end()) == 3);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 2);
+
+ c.resize(6, 10);
+ assert(distance(c.begin(), c.end()) == 6);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 2);
+ assert(*next(c.begin(), 3) == 10);
+ assert(*next(c.begin(), 4) == 10);
+ assert(*next(c.begin(), 5) == 10);
+
+ c.resize(6, 12);
+ assert(distance(c.begin(), c.end()) == 6);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 2);
+ assert(*next(c.begin(), 3) == 10);
+ assert(*next(c.begin(), 4) == 10);
+ assert(*next(c.begin(), 5) == 10);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t[] = {0, 1, 2, 3, 4};
+ C c(std::begin(t), std::end(t));
+
+ c.resize(3, 10);
+ assert(distance(c.begin(), c.end()) == 3);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 2);
+
+ c.resize(6, 10);
+ assert(distance(c.begin(), c.end()) == 6);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 2);
+ assert(*next(c.begin(), 3) == 10);
+ assert(*next(c.begin(), 4) == 10);
+ assert(*next(c.begin(), 5) == 10);
+
+ c.resize(6, 12);
+ assert(distance(c.begin(), c.end()) == 6);
+ assert(*next(c.begin(), 0) == 0);
+ assert(*next(c.begin(), 1) == 1);
+ assert(*next(c.begin(), 2) == 2);
+ assert(*next(c.begin(), 3) == 10);
+ assert(*next(c.begin(), 4) == 10);
+ assert(*next(c.begin(), 5) == 10);
+ }
+#endif
+}