• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

STEllAR-GROUP / hpx / #882

31 Aug 2023 07:44PM UTC coverage: 41.798% (-44.7%) from 86.546%
#882

push

19442 of 46514 relevant lines covered (41.8%)

126375.38 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

26.67
/libs/core/assertion/src/assertion.cpp
1
//  Copyright (c) 2019 Thomas Heller
2
//
3
//  SPDX-License-Identifier: BSL-1.0
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
#include <hpx/config.hpp>
8
#include <hpx/assertion/api.hpp>
9
#include <hpx/assertion/evaluate_assert.hpp>
10
#include <hpx/assertion/source_location.hpp>
11

12
#include <iostream>
13
#include <string>
14

15
namespace hpx::assertion {
16

×
17
    namespace detail {
18

19
        [[nodiscard]] assertion_handler& get_handler()
×
20
        {
21
            static assertion_handler handler = nullptr;
22
            return handler;
23
        }
64✔
24
    }    // namespace detail
25

64✔
26
    void set_assertion_handler(assertion_handler handler)
27
    {
64✔
28
        if (detail::get_handler() == nullptr)
29
        {
64✔
30
            detail::get_handler() = handler;
31
        }
32
    }
33

×
34
    namespace detail {
35

36
        void handle_assert(hpx::source_location const& loc, char const* expr,
×
37
            std::string const& msg) noexcept
38
        {
×
39
            if (get_handler() == nullptr)
×
40
            {
41
                std::cerr << loc << ": Assertion '" << expr << "' failed";
×
42
                if (!msg.empty())
43
                {
44
                    std::cerr << " (" << msg << ")\n";
45
                }
×
46
                else
47
                {
×
48
                    std::cerr << '\n';
49
                }
×
50
                std::abort();
×
51
            }
52
            get_handler()(loc, expr, msg);
53
        }
54
    }    // namespace detail
55
}    // namespace hpx::assertion
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc