| 1 | // |
|---|---|
| 2 | // Copyright (c) 2022 Dmitry Arkhipov (grisumbras@gmail.com) |
| 3 | // |
| 4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 6 | // |
| 7 | // Official repository: https://github.com/boostorg/json |
| 8 | // |
| 9 | |
| 10 | // Test that header file is self-contained. |
| 11 | #include <boost/json/result_for.hpp> |
| 12 | // Test that header file is properly guarder |
| 13 | #include <boost/json/result_for.hpp> |
| 14 | |
| 15 | #include <boost/json/value_to.hpp> |
| 16 | |
| 17 | #include "test_suite.hpp" |
| 18 | |
| 19 | namespace boost { |
| 20 | namespace json { |
| 21 | |
| 22 | class result_for_test |
| 23 | { |
| 24 | public: |
| 25 | void |
| 26 | run() |
| 27 | { |
| 28 | BOOST_STATIC_CONSTEXPR source_location loc = BOOST_CURRENT_LOCATION; |
| 29 | auto const res = result_from_errno<int>(EDOM, loc: &loc); |
| 30 | BOOST_TEST( res.has_error() ); |
| 31 | |
| 32 | auto const ec = res.error(); |
| 33 | BOOST_TEST( ec.has_location() ); |
| 34 | BOOST_TEST( ec.location() == loc ); |
| 35 | BOOST_TEST( ec.category() == system::generic_category() ); |
| 36 | BOOST_TEST( ec == std::errc::argument_out_of_domain ); |
| 37 | } |
| 38 | }; |
| 39 | |
| 40 | TEST_SUITE(result_for_test, "boost.json.result_for"); |
| 41 | |
| 42 | } // namespace json |
| 43 | } // namespace boost |
| 44 |
