Skip to content

Commit

Permalink
Merge pull request #1 from EricCousineau-TRI/sdf18_composition-meta
Browse files Browse the repository at this point in the history
fixup! add failing expectations on Parser::AddAllModelsFromFile
  • Loading branch information
azeey authored May 13, 2021
2 parents 0df2d5e + df25fd3 commit adccdff
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
27 changes: 27 additions & 0 deletions multibody/parsing/test/parser_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,33 @@ GTEST_TEST(FileParserTest, MultiModelTest) {
}
}

std::vector<std::string> GetModelInstanceNames(
const MultibodyPlant<double>& plant,
const std::vector<ModelInstanceIndex>& models) {
std::vector<std::string> names;
for (auto model : models) {
names.push_back(plant.GetModelInstanceName(model));
}
return names;
}

GTEST_TEST(FileParserTest, MultiModelViaWorldIncludesTest) {
const std::string sdf_name = FindResourceOrThrow(
"drake/multibody/parsing/test/sdf_parser_test/"
"world_with_directly_nested_models.sdf");
MultibodyPlant<double> plant(0.0);
const std::vector<ModelInstanceIndex> models =
Parser(&plant).AddAllModelsFromFile(sdf_name);
const std::vector<std::string> model_names_actual =
GetModelInstanceNames(plant, models);
const std::vector<std::string> model_names_expected = {
"parent_model",
"parent_model::robot_1",
"parent_model::robot_2",
};
EXPECT_EQ(model_names_actual, model_names_expected);
}

GTEST_TEST(FileParserTest, ExtensionMatchTest) {
// An unknown extension is an error.
// (Check both singular and plural overloads.)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@
</model>
</world>
</sdf>

0 comments on commit adccdff

Please sign in to comment.