|
48 | 48 | #undef max |
49 | 49 | #endif |
50 | 50 |
|
| 51 | +// On Windows, REQUIRE() might not be able to print more complex data structures |
| 52 | +// upon failure: |
| 53 | +// CoreTest.obj : error LNK2001: unresolved external symbol |
| 54 | +// "class std::string const Catch::Detail::unprintableString" (...) |
| 55 | +#ifdef _WIN32 |
| 56 | +#define OPENPMD_REQUIRE_GUARD_WINDOWS(...) \ |
| 57 | + do \ |
| 58 | + { \ |
| 59 | + bool guarded_require_boolean = __VA_ARGS__; \ |
| 60 | + REQUIRE(guarded_require_boolean); \ |
| 61 | + } while (0); |
| 62 | +#else |
| 63 | +#define OPENPMD_REQUIRE_GUARD_WINDOWS(...) REQUIRE(__VA_ARGS__) |
| 64 | +#endif |
| 65 | + |
51 | 66 | using namespace openPMD; |
52 | 67 |
|
53 | 68 | struct BackendSelection |
@@ -950,10 +965,10 @@ inline void constant_scalar(std::string const &file_ending) |
950 | 965 | E_mesh.setAxisLabels(axisLabels); |
951 | 966 | E_mesh.setUnitDimension(unitDimensions); |
952 | 967 | E_mesh.setTimeOffset(timeOffset); |
953 | | - REQUIRE( |
| 968 | + OPENPMD_REQUIRE_GUARD_WINDOWS( |
954 | 969 | E_mesh.gridUnitSIPerDimension() == std::vector<double>{1., 1., 1.}); |
955 | 970 | E_mesh.setGridUnitSI(std::vector(3, gridUnitSI)); |
956 | | - REQUIRE( |
| 971 | + OPENPMD_REQUIRE_GUARD_WINDOWS( |
957 | 972 | E_mesh.gridUnitSIPerDimension() == |
958 | 973 | std::vector<double>{gridUnitSI, gridUnitSI, gridUnitSI}); |
959 | 974 |
|
@@ -1116,7 +1131,7 @@ inline void constant_scalar(std::string const &file_ending) |
1116 | 1131 | Extent{3, 2, 1}); |
1117 | 1132 |
|
1118 | 1133 | Mesh &E_mesh = s.iterations[1].meshes["E"]; |
1119 | | - REQUIRE( |
| 1134 | + OPENPMD_REQUIRE_GUARD_WINDOWS( |
1120 | 1135 | E_mesh.gridUnitDimension() == |
1121 | 1136 | std::vector{ |
1122 | 1137 | std::array<double, 7>{1., 0., 0., 0., 0, .0, 0.}, |
|
0 commit comments