catch.cpp 733 Bytes
Newer Older
1
// The Catch implementation is compiled here. This is a standalone
2
3
// translation unit to avoid recompiling it for every test change.

4
5
#include <pybind11/embed.h>

6
#ifdef _MSC_VER
7
8
9
// Silence MSVC C++17 deprecation warning from Catch regarding std::uncaught_exceptions (up to
// catch 2.0.1; this should be fixed in the next catch release after 2.0.1).
#    pragma warning(disable : 4996)
10
11
#endif

12
13
// Catch uses _ internally, which breaks gettext style defines
#ifdef _
14
#    undef _
15
16
#endif

17
#define CATCH_CONFIG_RUNNER
18
#include <catch.hpp>
19
20
21

namespace py = pybind11;

22
int main(int argc, char *argv[]) {
23
24
25
26
27
    py::scoped_interpreter guard{};
    auto result = Catch::Session().run(argc, argv);

    return result < 0xff ? result : 0xff;
}