Dean Moldovan | 22c413b | 2017-03-30 00:20:42 +0200 | [diff] [blame] | 1 | // The Catch implementation is compiled here. This is a standalone |
Dean Moldovan | 9693a5c | 2017-03-23 17:27:32 +0100 | [diff] [blame] | 2 | // translation unit to avoid recompiling it for every test change. |
| 3 | |
Dean Moldovan | 22c413b | 2017-03-30 00:20:42 +0200 | [diff] [blame] | 4 | #include <pybind11/embed.h> |
| 5 | |
Jason Rhinelander | 3be401f | 2017-12-15 10:15:25 -0400 | [diff] [blame] | 6 | #ifdef _MSC_VER |
| 7 | // Silence MSVC C++17 deprecation warning from Catch regarding std::uncaught_exceptions (up to catch |
| 8 | // 2.0.1; this should be fixed in the next catch release after 2.0.1). |
| 9 | # pragma warning(disable: 4996) |
| 10 | #endif |
| 11 | |
Dean Moldovan | 22c413b | 2017-03-30 00:20:42 +0200 | [diff] [blame] | 12 | #define CATCH_CONFIG_RUNNER |
Dean Moldovan | 9693a5c | 2017-03-23 17:27:32 +0100 | [diff] [blame] | 13 | #include <catch.hpp> |
Dean Moldovan | 22c413b | 2017-03-30 00:20:42 +0200 | [diff] [blame] | 14 | |
| 15 | namespace py = pybind11; |
| 16 | |
Jason Rhinelander | f7bc18f | 2018-07-19 15:03:26 -0300 | [diff] [blame^] | 17 | int main(int argc, char *argv[]) { |
Dean Moldovan | 22c413b | 2017-03-30 00:20:42 +0200 | [diff] [blame] | 18 | py::scoped_interpreter guard{}; |
| 19 | auto result = Catch::Session().run(argc, argv); |
| 20 | |
| 21 | return result < 0xff ? result : 0xff; |
| 22 | } |