diff options
Diffstat (limited to 'libcxx/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors')
3 files changed, 81 insertions, 0 deletions
diff --git a/libcxx/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/ErrorConditionEnum.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/ErrorConditionEnum.pass.cpp new file mode 100644 index 00000000000..fbc03f1aa02 --- /dev/null +++ b/libcxx/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/ErrorConditionEnum.pass.cpp @@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +// template <ErrorConditionEnum E> error_condition(E e); + +#include <system_error> +#include <cassert> + +int main() +{ + { + std::error_condition ec(std::errc::not_a_directory); + assert(ec.value() == static_cast<int>(std::errc::not_a_directory)); + assert(ec.category() == std::generic_category()); + } +} diff --git a/libcxx/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/default.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/default.pass.cpp new file mode 100644 index 00000000000..a430ee2f7d8 --- /dev/null +++ b/libcxx/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/default.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 + +// error_condition(); + +#include <system_error> +#include <cassert> + +int main() +{ + std::error_condition ec; + assert(ec.value() == 0); + assert(ec.category() == std::generic_category()); +} diff --git a/libcxx/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/int_error_category.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/int_error_category.pass.cpp new file mode 100644 index 00000000000..f3b9eada765 --- /dev/null +++ b/libcxx/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/int_error_category.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_condition + +// error_condition(int val, const error_category& cat); + +#include <system_error> +#include <cassert> + +int main() +{ + { + std::error_condition ec(6, std::system_category()); + assert(ec.value() == 6); + assert(ec.category() == std::system_category()); + } + { + std::error_condition ec(8, std::generic_category()); + assert(ec.value() == 8); + assert(ec.category() == std::generic_category()); + } +} |