summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/experimental/any/any.class/any.observers/empty.pass.cpp
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2015-07-31 02:24:58 +0000
committerEric Fiselier <eric@efcs.ca>2015-07-31 02:24:58 +0000
commit3461dbc0a7beb7299fcec968bba87a32393e3252 (patch)
tree5f408f34b2629d285c0f32325f40893d60cc65ac /libcxx/test/std/experimental/any/any.class/any.observers/empty.pass.cpp
parent403cbcb84d8b8f459aaa7351472fee8b8df3e391 (diff)
downloadbcm5719-llvm-3461dbc0a7beb7299fcec968bba87a32393e3252.tar.gz
bcm5719-llvm-3461dbc0a7beb7299fcec968bba87a32393e3252.zip
[libcxx] Add <experimental/any> v2.
Summary: This patch adds the second revision of <experimental/any>. I've been working from the LFTS draft found at this link. https://rawgit.com/cplusplus/fundamentals-ts/v1/fundamentals-ts.html#any Reviewers: danalbert, jroelofs, K-ballo, mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6762 llvm-svn: 243728
Diffstat (limited to 'libcxx/test/std/experimental/any/any.class/any.observers/empty.pass.cpp')
-rw-r--r--libcxx/test/std/experimental/any/any.class/any.observers/empty.pass.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/libcxx/test/std/experimental/any/any.class/any.observers/empty.pass.cpp b/libcxx/test/std/experimental/any/any.class/any.observers/empty.pass.cpp
new file mode 100644
index 00000000000..8c681f37017
--- /dev/null
+++ b/libcxx/test/std/experimental/any/any.class/any.observers/empty.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <experimental/any>
+
+// any::empty() noexcept
+
+#include <experimental/any>
+#include <cassert>
+
+#include "any_helpers.h"
+
+int main()
+{
+ using std::experimental::any;
+ // noexcept test
+ {
+ any a;
+ static_assert(noexcept(a.empty()), "any::empty() must be noexcept");
+ }
+ // empty
+ {
+ any a;
+ assert(a.empty());
+
+ a.clear();
+ assert(a.empty());
+
+ a = 42;
+ assert(!a.empty());
+ }
+ // small object
+ {
+ small const s(1);
+ any a(s);
+ assert(!a.empty());
+
+ a.clear();
+ assert(a.empty());
+
+ a = s;
+ assert(!a.empty());
+ }
+ // large object
+ {
+ large const l(1);
+ any a(l);
+ assert(!a.empty());
+
+ a.clear();
+ assert(a.empty());
+
+ a = l;
+ assert(!a.empty());
+ }
+}
OpenPOWER on IntegriCloud