Specify is volume is too small or negative in mesh error messages. Fixes #799.

PiperOrigin-RevId: 525151156
Change-Id: Ia0e9d8b900b8c372e9229da934a4eb7aeb1a3b7a
This commit is contained in:
Alessio Quaglino
2023-04-18 08:15:52 -07:00
committed by Copybara-Service
parent d7ec409eb6
commit 94c4f72907
3 changed files with 28 additions and 4 deletions
+23 -1
View File
@@ -464,7 +464,29 @@ TEST_F(MjCMeshTest, VolumeTooSmall) {
EXPECT_THAT(error.data(), HasSubstr("mesh volume is too small"));
}
TEST_F(MjCMeshTest, VolumeTooSmallAllowedWorld) {
TEST_F(MjCMeshTest, VolumeNegative) {
static constexpr char xml[] = R"(
<mujoco>
<compiler exactmeshinertia="true"/>
<asset>
<mesh name="example_mesh"
vertex="0 0 0 1 0 0 0 1 0 0 0 1"
face="3 0 2 0 3 1 1 3 2 0 1 2" />
</asset>
<worldbody>
<body>
<geom type="mesh" mesh="example_mesh"/>
</body>
</worldbody>
</mujoco>
)";
std::array<char, 1024> error;
mjModel* model = LoadModelFromString(xml, error.data(), error.size());
EXPECT_THAT(model, testing::IsNull());
EXPECT_THAT(error.data(), HasSubstr("mesh volume is negative"));
}
TEST_F(MjCMeshTest, VolumeTooSmallAllowedWorld) {
static constexpr char xml[] = R"(
<mujoco>
<asset>