1// Copyright 2022 Peter Dimov.
2// Distributed under the Boost Software License, Version 1.0.
3// https://www.boost.org/LICENSE_1_0.txt
4
5#include <boost/system/result.hpp>
6#include <boost/core/lightweight_test_trait.hpp>
7
8using namespace boost::system;
9
10struct X {};
11
12int main()
13{
14 BOOST_TEST_TRAIT_SAME( result<int>::value_type, int );
15 BOOST_TEST_TRAIT_SAME( result<int>::error_type, error_code );
16
17 BOOST_TEST_TRAIT_SAME( result<X>::value_type, X );
18 BOOST_TEST_TRAIT_SAME( result<X>::error_type, error_code );
19
20 BOOST_TEST_TRAIT_SAME( result<void>::value_type, void );
21 BOOST_TEST_TRAIT_SAME( result<void>::error_type, error_code );
22
23 BOOST_TEST_TRAIT_SAME( result<int&>::value_type, int& );
24 BOOST_TEST_TRAIT_SAME( result<int&>::error_type, error_code );
25
26 BOOST_TEST_TRAIT_SAME( result<int, X>::value_type, int );
27 BOOST_TEST_TRAIT_SAME( result<int, X>::error_type, X );
28
29 BOOST_TEST_TRAIT_SAME( result<X, X>::value_type, X );
30 BOOST_TEST_TRAIT_SAME( result<X, X>::error_type, X );
31
32 BOOST_TEST_TRAIT_SAME( result<void, X>::value_type, void );
33 BOOST_TEST_TRAIT_SAME( result<void, X>::error_type, X );
34
35 BOOST_TEST_TRAIT_SAME( result<int&, X>::value_type, int& );
36 BOOST_TEST_TRAIT_SAME( result<int&, X>::error_type, X );
37
38 return boost::report_errors();
39}
40

source code of boost/libs/system/test/result_typedefs.cpp