Detect mismatch between maxNodes and Nodes in a gmsh block. Fixes #2342

PiperOrigin-RevId: 745967745
Change-Id: If1b5fcd71079a0e6a6def9b442758678e31a5828
This commit is contained in:
Mohammad Hamid
2025-04-10 04:14:34 -07:00
committed by Copybara-Service
parent eadd13038a
commit 3429a4881a
4 changed files with 111 additions and 0 deletions
+12
View File
@@ -697,6 +697,18 @@ TEST_F(UserFlexTest, LoadMSHASCII_41_MissingElement_Fail) {
mj_deleteModel(m);
}
TEST_F(UserFlexTest,
LoadMSHASCII_41_MismatchBetweenMaxNodesAndNodesInBlock_Fail) {
const std::string xml_path =
GetTestDataFilePath(
"user/testdata/malformed_cube_41_ascii_mismatch_between_max_nodes_and_nodes_in_block.xml");
std::array<char, 1024> error;
mjModel* m = mj_loadXML(xml_path.c_str(), 0, error.data(), error.size());
EXPECT_THAT(error.data(), HasSubstr(
"XML Error: Error: Maximum number of nodes must be equal to number of nodes in a block\nElement 'flexcomp', line 22\n"));
mj_deleteModel(m);
}
TEST_F(UserFlexTest, LoadMSHASCII_22_MissingNumNodes_Fail) {
const std::string xml_path =
GetTestDataFilePath(