• 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

0.0
/libs/core/program_options/examples/first.cpp
1
// Copyright Vladimir Prus 2002-2004.
2
//  SPDX-License-Identifier: BSL-1.0
3
// Distributed under the Boost Software License, Version 1.0.
4
// (See accompanying file LICENSE_1_0.txt
5
// or copy at http://www.boost.org/LICENSE_1_0.txt)
6

7
/* The simplest usage of the library.
8
 */
9

10
#include <hpx/modules/program_options.hpp>
11

12
#include <iostream>
13

14
#include <hpx/config/warnings_prefix.hpp>
15

16
namespace po = hpx::program_options;
17
using namespace std;
×
18

19
int main(int ac, char* av[])
20
{
21
    try
×
22
    {
23
        po::options_description desc("Allowed options");
×
24
        // clang-format off
×
25
        desc.add_options()
×
26
            ("help", "produce help message")
27
            ("compression", po::value<double>(), "set compression level")
28
        ;
29
        // clang-format on
×
30

×
31
        po::variables_map vm;
32
        po::store(po::command_line_parser(ac, av)
33
                      .allow_unregistered()
×
34
                      .options(desc)
35
                      .run(),
×
36
            vm);
37
        po::notify(vm);
×
38

39
        if (vm.count("help"))
×
40
        {
41
            cout << desc << "\n";
42
            return 0;
43
        }
×
44

45
        if (vm.count("compression"))
46
        {
×
47
            cout << "Compression level was set to "
48
                 << vm["compression"].as<double>() << ".\n";
49
        }
50
        else
×
51
        {
52
            cout << "Compression level was not set.\n";
×
53
        }
×
54
    }
55
    catch (exception const& e)
×
56
    {
57
        cerr << "error: " << e.what() << "\n";
×
58
        return 1;
×
59
    }
60
    catch (...)
×
61
    {
×
62
        cerr << "Exception of unknown type!\n";
63
    }
64
    return 0;
65
}
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