summaryrefslogtreecommitdiffstats
path: root/libcxx/test/containers/associative/map/map.modifiers/clear.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/containers/associative/map/map.modifiers/clear.pass.cpp')
-rw-r--r--libcxx/test/containers/associative/map/map.modifiers/clear.pass.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/libcxx/test/containers/associative/map/map.modifiers/clear.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/clear.pass.cpp
new file mode 100644
index 00000000000..1c0fd4e6edd
--- /dev/null
+++ b/libcxx/test/containers/associative/map/map.modifiers/clear.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// void clear();
+
+#include <map>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::map<int, double> M;
+ typedef std::pair<int, double> P;
+ P ar[] =
+ {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ m.clear();
+ assert(m.size() == 0);
+ }
+}
OpenPOWER on IntegriCloud