Use a negative size instead of overflow in EngineIoTest.

The MSVC build on GH Actions doesn't detect overflows in mjData or mjModel sizes, so use a negative size instead to trigger an intentional failure in the test.

PiperOrigin-RevId: 465529615
Change-Id: Ic7f15eed782cdda11b29984b136ed4f625418cc8
This commit is contained in:
Nimrod Gileadi
2022-08-05 03:54:00 -07:00
committed by Copybara-Service
parent b966a37855
commit fae896c51b
+3 -3
View File
@@ -186,9 +186,9 @@ TEST_F(EngineIoTest, MakeDataReturnsNullOnFailure) {
mjModel* model = LoadModelFromString(xml, error.data(), error.size());
ASSERT_THAT(model, NotNull()) << "Failed to load model: " << error.data();
// trigger overflow intentionally
model->nbody = INT_MAX;
static bool warning = false;
// fail mj_makeData intentionally with a bad size
model->nbody = -1;
static bool warning;
warning = false;
mju_user_warning = [](const char* error) {
warning = true;