mirror of
https://github.com/boostorg/system.git
synced 2025-07-30 04:27:14 +02:00
Add win32_generic_test. Refs #97.
This commit is contained in:
@ -130,6 +130,8 @@ boost_test(TYPE compile SOURCES constexpr_test2.cpp)
|
|||||||
boost_test(TYPE run SOURCES error_code_test3.cpp)
|
boost_test(TYPE run SOURCES error_code_test3.cpp)
|
||||||
boost_test(TYPE run SOURCES std_interop_test15.cpp)
|
boost_test(TYPE run SOURCES std_interop_test15.cpp)
|
||||||
|
|
||||||
|
boost_test(TYPE run SOURCES win32_generic_test.cpp)
|
||||||
|
|
||||||
# result
|
# result
|
||||||
|
|
||||||
set(BOOST_TEST_COMPILE_FEATURES cxx_std_11)
|
set(BOOST_TEST_COMPILE_FEATURES cxx_std_11)
|
||||||
|
@ -158,6 +158,8 @@ compile constexpr_test2.cpp ;
|
|||||||
run error_code_test3.cpp ;
|
run error_code_test3.cpp ;
|
||||||
run std_interop_test15.cpp ;
|
run std_interop_test15.cpp ;
|
||||||
|
|
||||||
|
run win32_generic_test.cpp ;
|
||||||
|
|
||||||
# result
|
# result
|
||||||
|
|
||||||
import ../../config/checks/config : requires ;
|
import ../../config/checks/config : requires ;
|
||||||
|
52
test/win32_generic_test.cpp
Normal file
52
test/win32_generic_test.cpp
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
// Copyright 2022 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/system.hpp>
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <boost/config/pragma_message.hpp>
|
||||||
|
|
||||||
|
#if !defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
|
||||||
|
|
||||||
|
BOOST_PRAGMA_MESSAGE( "Skipping test, BOOST_SYSTEM_HAS_SYSTEM_ERROR is not defined" )
|
||||||
|
int main() {}
|
||||||
|
|
||||||
|
#elif !defined(BOOST_MSSTL_VERSION) || BOOST_MSSTL_VERSION < 140
|
||||||
|
|
||||||
|
BOOST_PRAGMA_MESSAGE( "Skipping test, BOOST_MSSTL_VERSION is not defined or is less than 140" )
|
||||||
|
int main() {}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <system_error>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
namespace sys = boost::system;
|
||||||
|
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
|
for( int i = 0; i < 65000; ++i )
|
||||||
|
{
|
||||||
|
sys::error_code ec1( i, sys::system_category() );
|
||||||
|
sys::error_condition en1 = ec1.default_error_condition();
|
||||||
|
|
||||||
|
std::error_code ec2( i, std::system_category() );
|
||||||
|
std::error_condition en2 = ec2.default_error_condition();
|
||||||
|
|
||||||
|
if( en1 != en2 )
|
||||||
|
{
|
||||||
|
std::cout << en1 << " (" << en1.message() << ") != cond:" << en2.category().name() << ":" << en2.value() << " (" << en2.message() << ")\n";
|
||||||
|
|
||||||
|
if( en2.category() == std::generic_category() )
|
||||||
|
{
|
||||||
|
++n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return n < 256 ? n: 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Reference in New Issue
Block a user