From 999cf08bf5696cfa725147dea79d64b029dc7430 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 27 Aug 2020 17:47:06 +0300 Subject: [PATCH] Add system_category_test3 --- test/Jamfile.v2 | 1 + test/system_category_test3.cpp | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 test/system_category_test3.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 60150ea..fe6056a 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -83,3 +83,4 @@ run error_condition_test2.cpp ; run generic_category_test2.cpp ; run generic_category_test3.cpp ; run system_category_test2.cpp ; +run system_category_test3.cpp ; diff --git a/test/system_category_test3.cpp b/test/system_category_test3.cpp new file mode 100644 index 0000000..d03a305 --- /dev/null +++ b/test/system_category_test3.cpp @@ -0,0 +1,34 @@ +// Copyright 2020 Peter Dimov +// Distributed under the Boost Software License, Version 1.0 +// http://www.boost.org/LICENSE_1_0.txt + +#include +#include +#include +#include + +namespace sys = boost::system; + +int main() +{ + sys::error_category const & cat = sys::system_category(); + + // name + BOOST_TEST_CSTR_EQ( cat.name(), "system" ); + + // default_error_condition + BOOST_TEST( cat.default_error_condition( 0 ) == sys::error_condition() ); + BOOST_TEST( cat.default_error_condition( -1 ) == sys::error_condition( -1, cat ) ); + +#if defined(BOOST_WINDOWS_API) + + BOOST_TEST( cat.default_error_condition( 5 ) == sys::error_condition( EACCES, sys::generic_category() ) ); + +#else + + BOOST_TEST( cat.default_error_condition( EACCES ) == sys::error_condition( EACCES, sys::generic_category() ) ); + +#endif + + return boost::report_errors(); +}