From b41b48b612db47a30409b80b4d1bb793ab734377 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Fri, 15 Dec 2023 15:06:57 -0800 Subject: [PATCH] Link_TEST: use string literals for model string Signed-off-by: Steve Peters --- src/Link_TEST.cc | 270 ++++++++++++++++++++++++----------------------- 1 file changed, 136 insertions(+), 134 deletions(-) diff --git a/src/Link_TEST.cc b/src/Link_TEST.cc index 253233905..931fe0977 100644 --- a/src/Link_TEST.cc +++ b/src/Link_TEST.cc @@ -319,70 +319,71 @@ TEST(DOMLink, ResolveAutoInertialsWithNoCollisionsInLink) ///////////////////////////////////////////////// TEST(DOMLink, ResolveAutoInertialsWithDifferentDensity) { - std::string sdf = "" - "" - " " - " 0 0 1.0 0 0 0" - " " - " 0 1.0 0 0 0 0" - " " - " 12.0" - " " - " " - " 1.0 0 0 0 0 0" - " " - " " - " 1 1 1" - " " - " " - " " - " " - " " - " 0 2.0 0 0 0 0" - " " - " " - " 1.0 0 0 0 0 0" - " 24.0" - " " - " " - " 1 1 1" - " " - " " - " " - " " - " " - " 0 3.0 0 0 0 0" - " " - " 12.0" - " " - " " - " 1.0 0 0 0 0 0" - " 24.0" - " " - " " - " 1 1 1" - " " - " " - " " - " " - " " - " 0 4.0 0 0 0 0" - " " - " " - " 1.0 0 0 0 0 0" - " " - " " - " 1 1 1" - " " - " " - " " - " " - " " - ""; + const std::string sdfString = R"( + + + + 0 0 1.0 0 0 0 + + 0 1.0 0 0 0 0 + + 12.0 + + + 1.0 0 0 0 0 0 + + + 1 1 1 + + + + + + 0 2.0 0 0 0 0 + + + 1.0 0 0 0 0 0 + 24.0 + + + 1 1 1 + + + + + + 0 3.0 0 0 0 0 + + 12.0 + + + 1.0 0 0 0 0 0 + 24.0 + + + 1 1 1 + + + + + + 0 4.0 0 0 0 0 + + + 1.0 0 0 0 0 0 + + + 1 1 1 + + + + + + )"; sdf::Root root; const sdf::ParserConfig sdfParserConfig; - sdf::Errors errors = root.LoadSdfString(sdf, sdfParserConfig); + sdf::Errors errors = root.LoadSdfString(sdfString, sdfParserConfig); EXPECT_TRUE(errors.empty()) << errors; EXPECT_NE(nullptr, root.Element()); @@ -468,78 +469,79 @@ TEST(DOMLink, ResolveAutoInertialsWithDifferentDensity) ///////////////////////////////////////////////// TEST(DOMLink, ResolveAutoInertialsWithDifferentAutoInertiaParams) { - std::string sdf = "" - "" - " " - " 0 0 1.0 0 0 0" - " " - " 0 1.0 0 0 0 0" - " " - " " - " 12" - " 1 1 1" - " " - " " - " " - " 1.0 0 0 0 0 0" - " " - " " - " uri" - " " - " " - " " - " " - " " - " 0 2.0 0 0 0 0" - " " - " " - " 2.0 0 0 0 0 0" - " " - " 24" - " 1 1 1" - " " - " " - " " - " uri" - " " - " " - " " - " " - " " - " 0 3.0 0 0 0 0" - " " - " " - " 12" - " 1 1 1" - " " - " " - " " - " 3.0 0 0 0 0 0" - " " - " 24" - " 1 1 1" - " " - " " - " " - " uri" - " " - " " - " " - " " - " " - " 0 4.0 0 0 0 0" - " " - " " - " 4.0 0 0 0 0 0" - " " - " " - " uri" - " " - " " - " " - " " - " " - ""; + const std::string sdfString = R"( + + + + 0 0 1.0 0 0 0 + + 0 1.0 0 0 0 0 + + + 12 + 1 1 1 + + + + 1.0 0 0 0 0 0 + + + uri + + + + + + 0 2.0 0 0 0 0 + + + 2.0 0 0 0 0 0 + + 24 + 1 1 1 + + + + uri + + + + + + 0 3.0 0 0 0 0 + + + 12 + 1 1 1 + + + + 3.0 0 0 0 0 0 + + 24 + 1 1 1 + + + + uri + + + + + + 0 4.0 0 0 0 0 + + + 4.0 0 0 0 0 0 + + + uri + + + + + + )"; // Lambda function for registering as custom inertia calculator auto customMeshInertiaCalculator = []( @@ -585,7 +587,7 @@ TEST(DOMLink, ResolveAutoInertialsWithDifferentAutoInertiaParams) sdf::Root root; sdf::ParserConfig sdfParserConfig; sdfParserConfig.RegisterCustomInertiaCalc(customMeshInertiaCalculator); - sdf::Errors errors = root.LoadSdfString(sdf, sdfParserConfig); + sdf::Errors errors = root.LoadSdfString(sdfString, sdfParserConfig); EXPECT_TRUE(errors.empty()) << errors; EXPECT_NE(nullptr, root.Element());