summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2014-12-20 01:40:03 +0000
committerEric Fiselier <eric@efcs.ca>2014-12-20 01:40:03 +0000
commit5a83710e371fe68a06e6e3876c6a2c8b820a8976 (patch)
treeafde4c82ad6704681781c5cd49baa3fbd05c85db /libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers
parentf11e8eab527fba316c64112f6e05de1a79693a3e (diff)
downloadbcm5719-llvm-5a83710e371fe68a06e6e3876c6a2c8b820a8976.tar.gz
bcm5719-llvm-5a83710e371fe68a06e6e3876c6a2c8b820a8976.zip
Move test into test/std subdirectory.
llvm-svn: 224658
Diffstat (limited to 'libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers')
-rw-r--r--libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/bool.pass.cpp30
-rw-r--r--libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/category.pass.cpp23
-rw-r--r--libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/default_error_condition.pass.cpp31
-rw-r--r--libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/message.pass.cpp24
-rw-r--r--libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/value.pass.cpp23
5 files changed, 131 insertions, 0 deletions
diff --git a/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/bool.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/bool.pass.cpp
new file mode 100644
index 00000000000..0b20024013f
--- /dev/null
+++ b/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.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_code
+
+// explicit operator bool() const;
+
+#include <system_error>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ {
+ const std::error_code ec(6, std::generic_category());
+ assert(static_cast<bool>(ec));
+ }
+ {
+ const std::error_code ec(0, std::generic_category());
+ assert(!static_cast<bool>(ec));
+ }
+}
diff --git a/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/category.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/category.pass.cpp
new file mode 100644
index 00000000000..f2e50cf65ce
--- /dev/null
+++ b/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.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_code
+
+// const error_category& category() const;
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ const std::error_code ec(6, std::generic_category());
+ assert(ec.category() == std::generic_category());
+}
diff --git a/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/default_error_condition.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/default_error_condition.pass.cpp
new file mode 100644
index 00000000000..0a67cd5db6a
--- /dev/null
+++ b/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/default_error_condition.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_code
+
+// error_condition default_error_condition() const;
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ {
+ const std::error_code ec(6, std::generic_category());
+ std::error_condition e_cond = ec.default_error_condition();
+ assert(e_cond == ec);
+ }
+ {
+ const std::error_code ec(6, std::system_category());
+ std::error_condition e_cond = ec.default_error_condition();
+ assert(e_cond == ec);
+ }
+}
diff --git a/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/message.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/message.pass.cpp
new file mode 100644
index 00000000000..530f42ca9b8
--- /dev/null
+++ b/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.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_code
+
+// string message() const;
+
+#include <system_error>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ const std::error_code ec(6, std::generic_category());
+ assert(ec.message() == std::generic_category().message(6));
+}
diff --git a/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/value.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/value.pass.cpp
new file mode 100644
index 00000000000..1047b7d4213
--- /dev/null
+++ b/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.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_code
+
+// int value() const;
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ const std::error_code ec(6, std::system_category());
+ assert(ec.value() == 6);
+}
OpenPOWER on IntegriCloud