Added tests for xxx.size() and xxx.empty() for all the sequence containers

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318244 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/std/containers/sequences/deque/deque.capacity/empty.pass.cpp b/test/std/containers/sequences/deque/deque.capacity/empty.pass.cpp
new file mode 100644
index 0000000..629a51c
--- /dev/null
+++ b/test/std/containers/sequences/deque/deque.capacity/empty.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// class deque
+
+// bool empty() const noexcept;
+
+#include <deque>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::deque<int> C;
+    C c;
+    ASSERT_NOEXCEPT(c.empty());
+    assert(c.empty());
+    c.push_back(C::value_type(1));
+    assert(!c.empty());
+    c.clear();
+    assert(c.empty());
+    }
+#if TEST_STD_VER >= 11
+    {
+    typedef std::deque<int, min_allocator<int>> C;
+    C c;
+    ASSERT_NOEXCEPT(c.empty());
+    assert(c.empty());
+    c.push_back(C::value_type(1));
+    assert(!c.empty());
+    c.clear();
+    assert(c.empty());
+    }
+#endif
+}
diff --git a/test/std/containers/sequences/deque/deque.capacity/size.pass.cpp b/test/std/containers/sequences/deque/deque.capacity/size.pass.cpp
new file mode 100644
index 0000000..4974fc7
--- /dev/null
+++ b/test/std/containers/sequences/deque/deque.capacity/size.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// class deque
+
+// size_type size() const noexcept;
+
+#include <deque>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::deque<int> C;
+    C c;
+    ASSERT_NOEXCEPT(c.size());
+    assert(c.size() == 0);
+    c.push_back(C::value_type(2));
+    assert(c.size() == 1);
+    c.push_back(C::value_type(1));
+    assert(c.size() == 2);
+    c.push_back(C::value_type(3));
+    assert(c.size() == 3);
+    c.erase(c.begin());
+    assert(c.size() == 2);
+    c.erase(c.begin());
+    assert(c.size() == 1);
+    c.erase(c.begin());
+    assert(c.size() == 0);
+    }
+#if TEST_STD_VER >= 11
+    {
+    typedef std::deque<int, min_allocator<int>> C;
+    C c;
+    ASSERT_NOEXCEPT(c.size());
+    assert(c.size() == 0);
+    c.push_back(C::value_type(2));
+    assert(c.size() == 1);
+    c.push_back(C::value_type(1));
+    assert(c.size() == 2);
+    c.push_back(C::value_type(3));
+    assert(c.size() == 3);
+    c.erase(c.begin());
+    assert(c.size() == 2);
+    c.erase(c.begin());
+    assert(c.size() == 1);
+    c.erase(c.begin());
+    assert(c.size() == 0);
+    }
+#endif
+}
diff --git a/test/std/containers/sequences/forwardlist/empty.pass.cpp b/test/std/containers/sequences/forwardlist/empty.pass.cpp
new file mode 100644
index 0000000..1226e68
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/empty.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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>
+
+// class forward_list
+
+// bool empty() const noexcept;
+
+#include <forward_list>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::forward_list<int> C;
+    C c;
+    ASSERT_NOEXCEPT(c.empty());
+    assert(c.empty());
+    c.push_front(C::value_type(1));
+    assert(!c.empty());
+    c.clear();
+    assert(c.empty());
+    }
+#if TEST_STD_VER >= 11
+    {
+    typedef std::forward_list<int, min_allocator<int>> C;
+    C c;
+    ASSERT_NOEXCEPT(c.empty());
+    assert(c.empty());
+    c.push_front(C::value_type(1));
+    assert(!c.empty());
+    c.clear();
+    assert(c.empty());
+    }
+#endif
+}
diff --git a/test/std/containers/sequences/list/list.capacity/empty.pass.cpp b/test/std/containers/sequences/list/list.capacity/empty.pass.cpp
new file mode 100644
index 0000000..b564990
--- /dev/null
+++ b/test/std/containers/sequences/list/list.capacity/empty.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// class list
+
+// bool empty() const noexcept;
+
+#include <list>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::list<int> C;
+    C c;
+    ASSERT_NOEXCEPT(c.empty());
+    assert(c.empty());
+    c.push_back(C::value_type(1));
+    assert(!c.empty());
+    c.clear();
+    assert(c.empty());
+    }
+#if TEST_STD_VER >= 11
+    {
+    typedef std::list<int, min_allocator<int>> C;
+    C c;
+    ASSERT_NOEXCEPT(c.empty());
+    assert(c.empty());
+    c.push_back(C::value_type(1));
+    assert(!c.empty());
+    c.clear();
+    assert(c.empty());
+    }
+#endif
+}
diff --git a/test/std/containers/sequences/list/list.capacity/size.pass.cpp b/test/std/containers/sequences/list/list.capacity/size.pass.cpp
new file mode 100644
index 0000000..bddaeb5
--- /dev/null
+++ b/test/std/containers/sequences/list/list.capacity/size.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// class list
+
+// size_type size() const noexcept;
+
+#include <list>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::list<int> C;
+    C c;
+    ASSERT_NOEXCEPT(c.size());
+    assert(c.size() == 0);
+    c.push_back(C::value_type(2));
+    assert(c.size() == 1);
+    c.push_back(C::value_type(1));
+    assert(c.size() == 2);
+    c.push_back(C::value_type(3));
+    assert(c.size() == 3);
+    c.erase(c.begin());
+    assert(c.size() == 2);
+    c.erase(c.begin());
+    assert(c.size() == 1);
+    c.erase(c.begin());
+    assert(c.size() == 0);
+    }
+#if TEST_STD_VER >= 11
+    {
+    typedef std::list<int, min_allocator<int>> C;
+    C c;
+    ASSERT_NOEXCEPT(c.size());
+    assert(c.size() == 0);
+    c.push_back(C::value_type(2));
+    assert(c.size() == 1);
+    c.push_back(C::value_type(1));
+    assert(c.size() == 2);
+    c.push_back(C::value_type(3));
+    assert(c.size() == 3);
+    c.erase(c.begin());
+    assert(c.size() == 2);
+    c.erase(c.begin());
+    assert(c.size() == 1);
+    c.erase(c.begin());
+    assert(c.size() == 0);
+    }
+#endif
+}
diff --git a/test/std/containers/sequences/vector.bool/empty.pass.cpp b/test/std/containers/sequences/vector.bool/empty.pass.cpp
new file mode 100644
index 0000000..1471c39
--- /dev/null
+++ b/test/std/containers/sequences/vector.bool/empty.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// class vector
+
+// bool empty() const noexcept;
+
+#include <vector>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::vector<bool> C;
+    C c;
+    ASSERT_NOEXCEPT(c.empty());
+    assert(c.empty());
+    c.push_back(false);
+    assert(!c.empty());
+    c.clear();
+    assert(c.empty());
+    }
+#if TEST_STD_VER >= 11
+    {
+    typedef std::vector<bool, min_allocator<bool>> C;
+    C c;
+    ASSERT_NOEXCEPT(c.empty());
+    assert(c.empty());
+    c.push_back(false);
+    assert(!c.empty());
+    c.clear();
+    assert(c.empty());
+    }
+#endif
+}
diff --git a/test/std/containers/sequences/vector.bool/size.pass.cpp b/test/std/containers/sequences/vector.bool/size.pass.cpp
new file mode 100644
index 0000000..a1dcfd6
--- /dev/null
+++ b/test/std/containers/sequences/vector.bool/size.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// class vector
+
+// size_type size() const noexcept;
+
+#include <vector>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::vector<bool> C;
+    C c;
+    ASSERT_NOEXCEPT(c.size());
+    assert(c.size() == 0);
+    c.push_back(false);
+    assert(c.size() == 1);
+    c.push_back(true);
+    assert(c.size() == 2);
+    c.push_back(C::value_type(3));
+    assert(true);
+    c.erase(c.begin());
+    assert(c.size() == 2);
+    c.erase(c.begin());
+    assert(c.size() == 1);
+    c.erase(c.begin());
+    assert(c.size() == 0);
+    }
+#if TEST_STD_VER >= 11
+    {
+    typedef std::vector<bool, min_allocator<bool>> C;
+    C c;
+    ASSERT_NOEXCEPT(c.size());
+    assert(c.size() == 0);
+    c.push_back(false);
+    assert(c.size() == 1);
+    c.push_back(true);
+    assert(c.size() == 2);
+    c.push_back(C::value_type(3));
+    assert(true);
+    c.erase(c.begin());
+    assert(c.size() == 2);
+    c.erase(c.begin());
+    assert(c.size() == 1);
+    c.erase(c.begin());
+    assert(c.size() == 0);
+    }
+#endif
+}
diff --git a/test/std/containers/sequences/vector/vector.capacity/empty.pass.cpp b/test/std/containers/sequences/vector/vector.capacity/empty.pass.cpp
new file mode 100644
index 0000000..d816831
--- /dev/null
+++ b/test/std/containers/sequences/vector/vector.capacity/empty.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// class vector
+
+// bool empty() const noexcept;
+
+#include <vector>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::vector<int> C;
+    C c;
+    ASSERT_NOEXCEPT(c.empty());
+    assert(c.empty());
+    c.push_back(C::value_type(1));
+    assert(!c.empty());
+    c.clear();
+    assert(c.empty());
+    }
+#if TEST_STD_VER >= 11
+    {
+    typedef std::vector<int, min_allocator<int>> C;
+    C c;
+    ASSERT_NOEXCEPT(c.empty());
+    assert(c.empty());
+    c.push_back(C::value_type(1));
+    assert(!c.empty());
+    c.clear();
+    assert(c.empty());
+    }
+#endif
+}
diff --git a/test/std/containers/sequences/vector/vector.capacity/size.pass.cpp b/test/std/containers/sequences/vector/vector.capacity/size.pass.cpp
new file mode 100644
index 0000000..71f531c
--- /dev/null
+++ b/test/std/containers/sequences/vector/vector.capacity/size.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// class vector
+
+// size_type size() const noexcept;
+
+#include <vector>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::vector<int> C;
+    C c;
+    ASSERT_NOEXCEPT(c.size());
+    assert(c.size() == 0);
+    c.push_back(C::value_type(2));
+    assert(c.size() == 1);
+    c.push_back(C::value_type(1));
+    assert(c.size() == 2);
+    c.push_back(C::value_type(3));
+    assert(c.size() == 3);
+    c.erase(c.begin());
+    assert(c.size() == 2);
+    c.erase(c.begin());
+    assert(c.size() == 1);
+    c.erase(c.begin());
+    assert(c.size() == 0);
+    }
+#if TEST_STD_VER >= 11
+    {
+    typedef std::vector<int, min_allocator<int>> C;
+    C c;
+    ASSERT_NOEXCEPT(c.size());
+    assert(c.size() == 0);
+    c.push_back(C::value_type(2));
+    assert(c.size() == 1);
+    c.push_back(C::value_type(1));
+    assert(c.size() == 2);
+    c.push_back(C::value_type(3));
+    assert(c.size() == 3);
+    c.erase(c.begin());
+    assert(c.size() == 2);
+    c.erase(c.begin());
+    assert(c.size() == 1);
+    c.erase(c.begin());
+    assert(c.size() == 0);
+    }
+#endif
+}