summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/experimental/optional/optional.object/optional.object.observe
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/std/experimental/optional/optional.object/optional.object.observe')
-rw-r--r--libcxx/test/std/experimental/optional/optional.object/optional.object.observe/bool.pass.cpp31
-rw-r--r--libcxx/test/std/experimental/optional/optional.object/optional.object.observe/dereference.pass.cpp44
-rw-r--r--libcxx/test/std/experimental/optional/optional.object/optional.object.observe/dereference_const.pass.cpp52
-rw-r--r--libcxx/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow.pass.cpp43
-rw-r--r--libcxx/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp65
-rw-r--r--libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp59
-rw-r--r--libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value_const.fail.cpp33
-rw-r--r--libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp64
-rw-r--r--libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value_or.pass.cpp66
-rw-r--r--libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value_or_const.pass.cpp77
10 files changed, 0 insertions, 534 deletions
diff --git a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/bool.pass.cpp b/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/bool.pass.cpp
deleted file mode 100644
index a5bfae24007..00000000000
--- a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/bool.pass.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-// <optional>
-
-// constexpr explicit optional<T>::operator bool() const noexcept;
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-int main()
-{
- using std::experimental::optional;
-
- {
- constexpr optional<int> opt;
- static_assert(!opt, "");
- }
- {
- constexpr optional<int> opt(0);
- static_assert(opt, "");
- }
-}
diff --git a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/dereference.pass.cpp b/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/dereference.pass.cpp
deleted file mode 100644
index faba8d25606..00000000000
--- a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/dereference.pass.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-// <optional>
-
-// T& optional<T>::operator*();
-
-#ifdef _LIBCPP_DEBUG
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-using std::experimental::optional;
-
-struct X
-{
- constexpr int test() const {return 3;}
- int test() {return 4;}
-};
-
-int main()
-{
- {
- optional<X> opt(X{});
- assert((*opt).test() == 4);
- }
-#ifdef _LIBCPP_DEBUG
- {
- optional<X> opt;
- assert((*opt).test() == 3);
- assert(false);
- }
-#endif // _LIBCPP_DEBUG
-}
diff --git a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/dereference_const.pass.cpp b/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/dereference_const.pass.cpp
deleted file mode 100644
index f1bdc36424d..00000000000
--- a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/dereference_const.pass.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-// <optional>
-
-// constexpr const T& optional<T>::operator*() const;
-
-#ifdef _LIBCPP_DEBUG
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-using std::experimental::optional;
-
-struct X
-{
- constexpr int test() const {return 3;}
-};
-
-struct Y
-{
- int test() const {return 2;}
-};
-
-int main()
-{
- {
- constexpr optional<X> opt(X{});
- static_assert((*opt).test() == 3, "");
- }
- {
- constexpr optional<Y> opt(Y{});
- assert((*opt).test() == 2);
- }
-#ifdef _LIBCPP_DEBUG
- {
- const optional<X> opt;
- assert((*opt).test() == 3);
- assert(false);
- }
-#endif // _LIBCPP_DEBUG
-}
diff --git a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow.pass.cpp b/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow.pass.cpp
deleted file mode 100644
index 954ccd71ff5..00000000000
--- a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow.pass.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-// <optional>
-
-// constexpr T* optional<T>::operator->();
-
-#ifdef _LIBCPP_DEBUG
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-using std::experimental::optional;
-
-struct X
-{
- constexpr int test() const {return 3;}
-};
-
-int main()
-{
- {
- constexpr optional<X> opt(X{});
- static_assert(opt->test() == 3, "");
- }
-#ifdef _LIBCPP_DEBUG
- {
- optional<X> opt;
- assert(opt->test() == 3);
- assert(false);
- }
-#endif // _LIBCPP_DEBUG
-}
diff --git a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp b/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp
deleted file mode 100644
index 46586c65a6e..00000000000
--- a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-// <optional>
-
-// constexpr const T* optional<T>::operator->() const;
-
-#ifdef _LIBCPP_DEBUG
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-using std::experimental::optional;
-
-struct X
-{
- constexpr int test() const {return 3;}
-};
-
-struct Y
-{
- int test() const {return 2;}
-};
-
-struct Z
-{
- const Z* operator&() const {return this;}
- constexpr int test() const {return 1;}
-};
-
-int main()
-{
- {
- constexpr optional<X> opt(X{});
- static_assert(opt->test() == 3, "");
- }
- {
- constexpr optional<Y> opt(Y{});
- assert(opt->test() == 2);
- }
- {
- constexpr optional<Z> opt(Z{});
- assert(opt->test() == 1);
-#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
- static_assert(opt->test() == 1, "");
-#endif
- }
-#ifdef _LIBCPP_DEBUG
- {
- const optional<X> opt;
- assert(opt->test() == 3);
- assert(false);
- }
-#endif // _LIBCPP_DEBUG
-}
diff --git a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp b/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
deleted file mode 100644
index 72d7790590d..00000000000
--- a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-// XFAIL: availability=macosx10.12
-// XFAIL: availability=macosx10.11
-// XFAIL: availability=macosx10.10
-// XFAIL: availability=macosx10.9
-// XFAIL: availability=macosx10.8
-// XFAIL: availability=macosx10.7
-
-// <optional>
-
-// T& optional<T>::value();
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-#include "test_macros.h"
-
-using std::experimental::optional;
-using std::experimental::bad_optional_access;
-
-struct X
-{
- X() = default;
- X(const X&) = delete;
- constexpr int test() const {return 3;}
- int test() {return 4;}
-};
-
-int main()
-{
- {
- optional<X> opt;
- opt.emplace();
- assert(opt.value().test() == 4);
- }
-#ifndef TEST_HAS_NO_EXCEPTIONS
- {
- optional<X> opt;
- try
- {
- opt.value();
- assert(false);
- }
- catch (const bad_optional_access&)
- {
- }
- }
-#endif
-}
diff --git a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value_const.fail.cpp b/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value_const.fail.cpp
deleted file mode 100644
index baad3b47f3e..00000000000
--- a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value_const.fail.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-// <optional>
-
-// constexpr const T& optional<T>::value() const;
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-using std::experimental::optional;
-
-struct X
-{
- constexpr int test() const {return 3;}
- int test() {return 4;}
-};
-
-int main()
-{
- {
- constexpr optional<X> opt;
- static_assert(opt.value().test() == 3, "");
- }
-}
diff --git a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp b/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
deleted file mode 100644
index b3d6dfda4fb..00000000000
--- a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-// XFAIL: availability=macosx10.12
-// XFAIL: availability=macosx10.11
-// XFAIL: availability=macosx10.10
-// XFAIL: availability=macosx10.9
-// XFAIL: availability=macosx10.8
-// XFAIL: availability=macosx10.7
-
-// <optional>
-
-// constexpr const T& optional<T>::value() const;
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-#include "test_macros.h"
-
-using std::experimental::optional;
-using std::experimental::in_place_t;
-using std::experimental::in_place;
-using std::experimental::bad_optional_access;
-
-struct X
-{
- X() = default;
- X(const X&) = delete;
- constexpr int test() const {return 3;}
- int test() {return 4;}
-};
-
-int main()
-{
- {
- constexpr optional<X> opt(in_place);
- static_assert(opt.value().test() == 3, "");
- }
- {
- const optional<X> opt(in_place);
- assert(opt.value().test() == 3);
- }
-#ifndef TEST_HAS_NO_EXCEPTIONS
- {
- const optional<X> opt;
- try
- {
- opt.value();
- assert(false);
- }
- catch (const bad_optional_access&)
- {
- }
- }
-#endif
-}
diff --git a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value_or.pass.cpp b/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value_or.pass.cpp
deleted file mode 100644
index 6fca8c82ceb..00000000000
--- a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value_or.pass.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-// <optional>
-
-// template <class U> T optional<T>::value_or(U&& v) &&;
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-using std::experimental::optional;
-using std::experimental::in_place_t;
-using std::experimental::in_place;
-
-struct Y
-{
- int i_;
-
- Y(int i) : i_(i) {}
-};
-
-struct X
-{
- int i_;
-
- X(int i) : i_(i) {}
- X(X&& x) : i_(x.i_) {x.i_ = 0;}
- X(const Y& y) : i_(y.i_) {}
- X(Y&& y) : i_(y.i_+1) {}
- friend constexpr bool operator==(const X& x, const X& y)
- {return x.i_ == y.i_;}
-};
-
-int main()
-{
- {
- optional<X> opt(in_place, 2);
- Y y(3);
- assert(std::move(opt).value_or(y) == 2);
- assert(*opt == 0);
- }
- {
- optional<X> opt(in_place, 2);
- assert(std::move(opt).value_or(Y(3)) == 2);
- assert(*opt == 0);
- }
- {
- optional<X> opt;
- Y y(3);
- assert(std::move(opt).value_or(y) == 3);
- assert(!opt);
- }
- {
- optional<X> opt;
- assert(std::move(opt).value_or(Y(3)) == 4);
- assert(!opt);
- }
-}
diff --git a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value_or_const.pass.cpp b/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value_or_const.pass.cpp
deleted file mode 100644
index 4a008dce238..00000000000
--- a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value_or_const.pass.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-// <optional>
-
-// template <class U> constexpr T optional<T>::value_or(U&& v) const&;
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-using std::experimental::optional;
-
-struct Y
-{
- int i_;
-
- constexpr Y(int i) : i_(i) {}
-};
-
-struct X
-{
- int i_;
-
- constexpr X(int i) : i_(i) {}
- constexpr X(const Y& y) : i_(y.i_) {}
- constexpr X(Y&& y) : i_(y.i_+1) {}
- friend constexpr bool operator==(const X& x, const X& y)
- {return x.i_ == y.i_;}
-};
-
-int main()
-{
- {
- constexpr optional<X> opt(2);
- constexpr Y y(3);
- static_assert(opt.value_or(y) == 2, "");
- }
- {
- constexpr optional<X> opt(2);
- static_assert(opt.value_or(Y(3)) == 2, "");
- }
- {
- constexpr optional<X> opt;
- constexpr Y y(3);
- static_assert(opt.value_or(y) == 3, "");
- }
- {
- constexpr optional<X> opt;
- static_assert(opt.value_or(Y(3)) == 4, "");
- }
- {
- const optional<X> opt(2);
- const Y y(3);
- assert(opt.value_or(y) == 2);
- }
- {
- const optional<X> opt(2);
- assert(opt.value_or(Y(3)) == 2);
- }
- {
- const optional<X> opt;
- const Y y(3);
- assert(opt.value_or(y) == 3);
- }
- {
- const optional<X> opt;
- assert(opt.value_or(Y(3)) == 4);
- }
-}
OpenPOWER on IntegriCloud