-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathtest_main.cc
More file actions
27 lines (20 loc) · 817 Bytes
/
test_main.cc
File metadata and controls
27 lines (20 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "test_utils.h"
#include "utils.h"
#include <catch2/catch_session.hpp>
/**
* We provide a custom main function to add additional CLI flags.
*/
int main(int argc, char* argv[]) {
Catch::Session session;
using namespace Catch::Clara;
const auto cli = session.cli() | Opt(celerity::test_utils::g_print_graphs)["--print-graphs"]("print graphs (GraphViz)");
session.cli(cli);
int return_code = session.applyCommandLine(argc, argv);
if(return_code != 0) { return return_code; }
// allow unit tests to catch and recover from panics
celerity::detail::utils::set_panic_solution(celerity::detail::utils::panic_solution::throw_logic_error);
celerity::detail::runtime_testspy::test_mode_enter();
return_code = session.run();
celerity::detail::runtime_testspy::test_mode_exit();
return return_code;
}