Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent crash in unit tests #132

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions Tests/forcefield/BeamHookeLawForceFieldTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ struct BeamHookeLawForceFieldTest : public testing::NumericTest<> {
typedef typename DataTypes::Coord Coord;
typedef typename Coord::value_type Real;

BeamHookeLawForceFieldTest()
{
root = sofa::simpleapi::createRootNode(sofa::simulation::getSimulation(), "root");

createObject(root, "DefaultAnimationLoop");
createObject(root, "DefaultVisualManagerLoop");
}



typedef sofa::component::forcefield::BeamHookeLawForceField<DataTypes> TheBeamHookeLawForceField;
Expand Down Expand Up @@ -109,6 +117,7 @@ struct BeamHookeLawForceFieldTest : public testing::NumericTest<> {
template<>
void BeamHookeLawForceFieldTest<defaulttype::Vec3Types>::testFonctionnel() {
EXPECT_MSG_NOEMIT(Error, Warning) ;
ASSERT_NE(root, nullptr);
createObject(root, "MechanicalObject", {{"position", "-1 0 1 1 0 1 -1 0 -1 1 0 -1 0 0 1 0 0 -1 -1 0 0 1 0 0 0 0 0"}});
createObject(root, "TriangleSetTopologyContainer", {{"triangles", "7 5 8 8 2 6 4 6 0 1 8 4 7 3 5 8 5 2 4 8 6 1 7 8"}});

Expand All @@ -118,7 +127,7 @@ void BeamHookeLawForceFieldTest<defaulttype::Vec3Types>::testFonctionnel() {
{"lengthY", "35e-5"},
{"lengthZ", "1374e-5"},
{"radius", "0.25"},
{"varianteSections", "true"}}).get()
{"variantSections", "true"}}).get()
);

EXPECT_NE(traction, nullptr);
Expand Down Expand Up @@ -161,7 +170,7 @@ void BeamHookeLawForceFieldTest<defaulttype::Vec3Types>::basicAttributesTest(){
/// This list needs to be updated if you add an attribute.
sofa::type::vector<std::string> attrnames = {
"crossSectionShape","youngModulus","poissonRatio","length", "radius",
"innerRadius", "lengthY", "lengthZ", "varianteSections", "youngModululsList", "poissonRatioList"
"innerRadius", "lengthY", "lengthZ", "variantSections", "youngModulusList", "poissonRatioList"
};

for(auto& attrname : attrnames)
Expand Down
Loading