Improve error message for fullinertia and orientation specifiers.
Fixes #1888. PiperOrigin-RevId: 661359190 Change-Id: Ibe38e88024b4a43922352b42347abf1026f168a2
This commit is contained in:
committed by
Copybara-Service
parent
ebd8615554
commit
da15aa6a0e
@@ -3344,7 +3344,7 @@ void mjXReader::Body(XMLElement* section, mjsBody* pbody, mjsFrame* frame,
|
||||
bool alt = ReadAlternative(elem, pbody->ialt);
|
||||
bool full = ReadAttr(elem, "fullinertia", 6, pbody->fullinertia, text);
|
||||
if (alt && full) {
|
||||
throw mjXError(elem, "multiple orientation specifiers are not allowed");
|
||||
throw mjXError(elem, "fullinertia and orientation specifiers cannot be used together");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1637,8 +1637,10 @@ TEST_F(XMLReaderTest, InvalidInertialOrientation) {
|
||||
std::array<char, 1024> error;
|
||||
mjModel* model = LoadModelFromString(xml, error.data(), error.size());
|
||||
ASSERT_THAT(model, IsNull());
|
||||
EXPECT_THAT(error.data(),
|
||||
HasSubstr("multiple orientation specifiers are not allowed"));
|
||||
EXPECT_THAT(
|
||||
error.data(),
|
||||
HasSubstr(
|
||||
"fullinertia and orientation specifiers cannot be used together"));
|
||||
}
|
||||
|
||||
TEST_F(XMLReaderTest, ReadShellParameter) {
|
||||
|
||||
Reference in New Issue
Block a user