1 // Refer to https://github.com/philsquared/Catch/blob/master/docs/own-main.md
2 // for providing our own main function to Catch
3 #define CATCH_CONFIG_RUNNER
4 
5 #include "test.hpp"
6 
7 #include <vector>
8 
9 // NB: ENABLE_PCP_LOGGING could be defined in test.hpp
10 #ifdef ENABLE_PCP_LOGGING
11 #define LEATHERMAN_LOGGING_NAMESPACE "puppetlabs.cpp_pcp_client.test"
12 #include <leatherman/logging/logging.hpp>
13 #include <boost/nowide/iostream.hpp>
14 #endif
15 
main(int argc,char ** argv)16 int main(int argc, char** argv) {
17 #ifdef ENABLE_PCP_LOGGING
18     leatherman::logging::setup_logging(boost::nowide::cout);
19     leatherman::logging::set_level(leatherman::logging::log_level::debug);
20 #endif
21 
22     // Create the Catch session, pass CL args, and start it
23     Catch::Session test_session {};
24 
25     // NOTE(ale): to list the reporters use:
26     // test_session.configData().listReporters = true;
27 
28     // NOTE(ale): out of the box, Reporters are "xml", "junit", "console",
29     // and "compact" (single line); "console" is the default
30     // test_session.configData().reporterNames =
31     //      std::vector<std::string> { "xml" };
32 
33     // ShowDurations::Always, ::Never, ::DefaultForReporter
34     test_session.configData().showDurations = Catch::ShowDurations::Always;
35 
36     // NOTE(ale): enforcing ConfigData::useColour == UseColour::No
37     // on Windows is not necessary; the default ::Auto works fine
38 
39     return test_session.run(argc, argv);
40 }
41