summaryrefslogtreecommitdiff
path: root/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers')
-rw-r--r--test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/bool.pass.cpp30
-rw-r--r--test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/category.pass.cpp23
-rw-r--r--test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/message.pass.cpp24
-rw-r--r--test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/value.pass.cpp23
4 files changed, 100 insertions, 0 deletions
diff --git a/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/bool.pass.cpp b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/bool.pass.cpp
new file mode 100644
index 0000000000000..edeca06d38b5c
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/bool.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_condition
+
+// explicit operator bool() const;
+
+#include <system_error>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ {
+ const std::error_condition ec(6, std::generic_category());
+ assert(static_cast<bool>(ec));
+ }
+ {
+ const std::error_condition ec(0, std::generic_category());
+ assert(!static_cast<bool>(ec));
+ }
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/category.pass.cpp b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/category.pass.cpp
new file mode 100644
index 0000000000000..fd3e698566b29
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/category.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_condition
+
+// const error_category& category() const;
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ const std::error_condition ec(6, std::generic_category());
+ assert(ec.category() == std::generic_category());
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/message.pass.cpp b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/message.pass.cpp
new file mode 100644
index 0000000000000..6a60f50f410d3
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/message.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_condition
+
+// string message() const;
+
+#include <system_error>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ const std::error_condition ec(6, std::generic_category());
+ assert(ec.message() == std::generic_category().message(6));
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/value.pass.cpp b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/value.pass.cpp
new file mode 100644
index 0000000000000..c755673126bdd
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/value.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_condition
+
+// int value() const;
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ const std::error_condition ec(6, std::system_category());
+ assert(ec.value() == 6);
+}