From f237b4911ace139b0e357c6b0aafa070228e9813 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Fri, 5 Apr 2024 08:49:47 -0700 Subject: [PATCH] w3 --- dart/dynamics/BodyNode.cpp | 2 +- dart/dynamics/EulerJoint.cpp | 6 +-- dart/dynamics/Node.cpp | 4 +- dart/dynamics/Skeleton.cpp | 12 ++--- dart/math/Geometry.cpp | 2 +- examples/wam_ikfast/Helpers.cpp | 2 +- python/dartpy/eigen_geometry_pybind.cpp | 8 ++-- tests/integration/test_Constraint.cpp | 4 +- tests/integration/test_Dynamics.cpp | 46 +++++++++---------- tests/integration/test_IkFast.cpp | 2 +- tests/integration/test_Joints.cpp | 12 ++--- tests/integration/test_MetaSkeleton.cpp | 2 +- .../test_MultiObjectiveOptimization.cpp | 8 ++-- tests/integration/test_Skeleton.cpp | 10 ++-- tests/integration/test_SoftDynamics.cpp | 4 +- tests/integration/test_World.cpp | 2 +- tests/regression/test_Issue1184.cpp | 2 +- tests/regression/test_Issue1596.cpp | 2 +- tests/unit/common/test_MemoryManager.cpp | 4 +- tests/unit/math/test_Math.cpp | 2 +- 20 files changed, 68 insertions(+), 68 deletions(-) diff --git a/dart/dynamics/BodyNode.cpp b/dart/dynamics/BodyNode.cpp index bcd8f56e3faa2..cd2907f94eb39 100644 --- a/dart/dynamics/BodyNode.cpp +++ b/dart/dynamics/BodyNode.cpp @@ -1383,7 +1383,7 @@ void BodyNode::init(const SkeletonPtr& _skeleton) mConstDependentDofs.push_back(_skeleton->getDof(index)); } -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG // Check whether there is duplicated indices. std::size_t nDepGenCoordIndices = mDependentGenCoordIndices.size(); for (std::size_t i = 0; i < nDepGenCoordIndices; ++i) { diff --git a/dart/dynamics/EulerJoint.cpp b/dart/dynamics/EulerJoint.cpp index 326b21c5ee4a0..18c66d37ee74a 100644 --- a/dart/dynamics/EulerJoint.cpp +++ b/dart/dynamics/EulerJoint.cpp @@ -209,7 +209,7 @@ Eigen::Matrix EulerJoint::getRelativeJacobianStatic( J1 << s2, c2, 0.0, 0.0, 0.0, 0.0; J2 << 0.0, 0.0, 1.0, 0.0, 0.0, 0.0; -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG if (std::abs(getPositionsStatic()[1]) == math::constantsd::pi() * 0.5) std::cout << "Singular configuration in ZYX-euler joint [" << Joint::mAspectProperties.mName << "]. (" << _positions[0] @@ -232,7 +232,7 @@ Eigen::Matrix EulerJoint::getRelativeJacobianStatic( J1 << 0.0, c2, -s2, 0.0, 0.0, 0.0; J2 << 1.0, 0.0, 0.0, 0.0, 0.0, 0.0; -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG if (std::abs(_positions[1]) == math::constantsd::pi() * 0.5) std::cout << "Singular configuration in ZYX-euler joint [" << Joint::mAspectProperties.mName << "]. (" << _positions[0] @@ -254,7 +254,7 @@ Eigen::Matrix EulerJoint::getRelativeJacobianStatic( assert(!math::isNan(J)); -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG Eigen::MatrixXd JTJ = J.transpose() * J; Eigen::FullPivLU luJTJ(JTJ); // Eigen::FullPivLU luS(mS); diff --git a/dart/dynamics/Node.cpp b/dart/dynamics/Node.cpp index ac26b873b5028..b3eba85dd9c1b 100644 --- a/dart/dynamics/Node.cpp +++ b/dart/dynamics/Node.cpp @@ -189,7 +189,7 @@ void Node::attach() // If we are in release mode, and the Node believes it is attached, then we // can shortcut this procedure -#if DART_BUILD_MODE_RELEASE +#ifdef NDEBUG if (mAmAttached) return; #endif @@ -241,7 +241,7 @@ void Node::stageForRemoval() // If we are in release mode, and the Node believes it is detached, then we // can shortcut this procedure. -#if DART_BUILD_MODE_RELEASE +#ifdef NDEBUG if (!mAmAttached) return; #endif diff --git a/dart/dynamics/Skeleton.cpp b/dart/dynamics/Skeleton.cpp index 16a76c4616f0b..746bcada3de00 100644 --- a/dart/dynamics/Skeleton.cpp +++ b/dart/dynamics/Skeleton.cpp @@ -2106,7 +2106,7 @@ void Skeleton::constructNewTree() //============================================================================== void Skeleton::registerBodyNode(BodyNode* _newBodyNode) { -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG std::vector::iterator repeat = std::find( mSkelCache.mBodyNodes.begin(), mSkelCache.mBodyNodes.end(), _newBodyNode); if (repeat != mSkelCache.mBodyNodes.end()) { @@ -2155,7 +2155,7 @@ void Skeleton::registerBodyNode(BodyNode* _newBodyNode) updateTotalMass(); updateCacheDimensions(_newBodyNode->mTreeIndex); -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG for (std::size_t i = 0; i < mSkelCache.mBodyNodes.size(); ++i) { if (mSkelCache.mBodyNodes[i]->mIndexInSkeleton != i) { dterr << "[Skeleton::registerBodyNode] BodyNode named [" @@ -3656,7 +3656,7 @@ void Skeleton::updateBiasImpulse(BodyNode* _bodyNode) // This skeleton should contain _bodyNode assert(_bodyNode->getSkeleton().get() == this); -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG // All the constraint impulse should be zero for (std::size_t i = 0; i < mSkelCache.mBodyNodes.size(); ++i) assert( @@ -3687,7 +3687,7 @@ void Skeleton::updateBiasImpulse( // This skeleton should contain _bodyNode assert(_bodyNode->getSkeleton().get() == this); -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG // All the constraint impulse should be zero for (std::size_t i = 0; i < mSkelCache.mBodyNodes.size(); ++i) assert( @@ -3734,7 +3734,7 @@ void Skeleton::updateBiasImpulse( assert(_bodyNode1->getSkeleton().get() == this); assert(_bodyNode2->getSkeleton().get() == this); -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG // All the constraint impulse should be zero for (std::size_t i = 0; i < mSkelCache.mBodyNodes.size(); ++i) assert( @@ -3775,7 +3775,7 @@ void Skeleton::updateBiasImpulse( std::find(mSoftBodyNodes.begin(), mSoftBodyNodes.end(), _softBodyNode) != mSoftBodyNodes.end()); -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG // All the constraint impulse should be zero for (std::size_t i = 0; i < mSkelCache.mBodyNodes.size(); ++i) assert( diff --git a/dart/math/Geometry.cpp b/dart/math/Geometry.cpp index ac77033cd722a..2944cb35c4c23 100644 --- a/dart/math/Geometry.cpp +++ b/dart/math/Geometry.cpp @@ -1478,7 +1478,7 @@ bool verifyTransform(const Eigen::Isometry3d& _T) Eigen::Vector3d fromSkewSymmetric(const Eigen::Matrix3d& _m) { -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG if (std::abs(_m(0, 0)) > DART_EPSILON || std::abs(_m(1, 1)) > DART_EPSILON || std::abs(_m(2, 2)) > DART_EPSILON) { dtwarn << "[math::fromSkewSymmetric] Not skew a symmetric matrix:\n" diff --git a/examples/wam_ikfast/Helpers.cpp b/examples/wam_ikfast/Helpers.cpp index 7f9a81d40956f..1a1d2c21819da 100644 --- a/examples/wam_ikfast/Helpers.cpp +++ b/examples/wam_ikfast/Helpers.cpp @@ -109,7 +109,7 @@ void setupEndEffectors(const dart::dynamics::SkeletonPtr& wam) std::stringstream ss; ss << DART_SHARED_LIB_PREFIX << "wamIk"; -#if (DART_OS_LINUX || DART_OS_MACOS) && DART_BUILD_MODE_DEBUG +#if (DART_OS_LINUX || DART_OS_MACOS) && !defined(NDEBUG) ss << "d"; #endif ss << "." << DART_SHARED_LIB_EXTENSION; diff --git a/python/dartpy/eigen_geometry_pybind.cpp b/python/dartpy/eigen_geometry_pybind.cpp index c6a04b0ea97ef..5bbaeb61a4b79 100644 --- a/python/dartpy/eigen_geometry_pybind.cpp +++ b/python/dartpy/eigen_geometry_pybind.cpp @@ -34,12 +34,12 @@ #include "eigen_geometry_pybind.h" -#include -#include +#include "pybind11/pybind11.h" #include -#include "pybind11/pybind11.h" +#include +#include using std::fabs; @@ -60,7 +60,7 @@ namespace { // N.B. Use a loose tolerance, so that we don't have to be super strict with // C++. -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG const double kCheckTolerance = 1e-5; #endif diff --git a/tests/integration/test_Constraint.cpp b/tests/integration/test_Constraint.cpp index e1c0c7c124f76..0da2177130e0e 100644 --- a/tests/integration/test_Constraint.cpp +++ b/tests/integration/test_Constraint.cpp @@ -112,7 +112,7 @@ void ConstraintTest::SingleContactTest(const std::string& /*_fileName*/) // Settings //---------------------------------------------------------------------------- // Number of random state tests for each skeletons -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG // std::size_t testCount = 1; #else // std::size_t testCount = 1; @@ -222,7 +222,7 @@ TEST_F(ConstraintTest, SingleContactTest) { // for (int i = 0; i < getList().size(); ++i) // { - // #if DART_BUILD_MODE_DEBUG + // #ifndef NDEBUG // dtdbg << getList()[i] << std::endl; // #endif // SingleContactTest(getList()[i]); diff --git a/tests/integration/test_Dynamics.cpp b/tests/integration/test_Dynamics.cpp index 09f9755505e56..d5f6a04913bb5 100644 --- a/tests/integration/test_Dynamics.cpp +++ b/tests/integration/test_Dynamics.cpp @@ -862,7 +862,7 @@ void DynamicsTest::testJacobians(const common::Uri& uri) //----------------------------- Settings ------------------------------------- const double TOLERANCE = 1.0e-6; -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG int nTestItr = 2; #else int nTestItr = 5; @@ -958,7 +958,7 @@ void DynamicsTest::testJacobians(const common::Uri& uri) compareBodyNodeFkToJacobianRelative(bn, bn, Frame::World(), TOLERANCE); -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG if (skeleton->getNumBodyNodes() == 0u) continue; @@ -1034,7 +1034,7 @@ void DynamicsTest::testFiniteDifferenceGeneralizedCoordinates( using namespace utils; //----------------------------- Settings ------------------------------------- -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG int nRandomItr = 2; #else int nRandomItr = 10; @@ -1121,7 +1121,7 @@ void DynamicsTest::testFiniteDifferenceBodyNodeVelocity(const common::Uri& uri) using namespace utils; //----------------------------- Settings ------------------------------------- -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG int nRandomItr = 2; std::size_t numSteps = 1e+1; #else @@ -1211,7 +1211,7 @@ void DynamicsTest::testFiniteDifferenceBodyNodeAcceleration( //----------------------------- Settings ------------------------------------- const double TOLERANCE = 1.0e-2; -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG int nRandomItr = 2; #else int nRandomItr = 10; @@ -1342,7 +1342,7 @@ void DynamicsTest::testFiniteDifferenceBodyNodeAcceleration( //============================================================================== void testForwardKinematicsSkeleton(const dynamics::SkeletonPtr& skel) { -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG std::size_t nRandomItr = 1e+1; std::size_t numSteps = 1e+1; #else @@ -1471,7 +1471,7 @@ void DynamicsTest::testInverseDynamics(const common::Uri& uri) { //---------------------------- Settings -------------------------------------- // Number of random state tests for each skeleton -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG const std::size_t nRandomItr = 2; #else const std::size_t nRandomItr = 100; @@ -1554,7 +1554,7 @@ void DynamicsTest::compareEquationsOfMotion(const common::Uri& uri) //---------------------------- Settings -------------------------------------- // Number of random state tests for each skeletons -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG std::size_t nRandomItr = 2; #else std::size_t nRandomItr = 100; @@ -1831,7 +1831,7 @@ void DynamicsTest::testCenterOfMass(const common::Uri& uri) //---------------------------- Settings -------------------------------------- // Number of random state tests for each skeletons -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG std::size_t nRandomItr = 2; #else std::size_t nRandomItr = 100; @@ -1984,7 +1984,7 @@ void DynamicsTest::testCenterOfMassFreeFall(const common::Uri& uri) //---------------------------- Settings -------------------------------------- // Number of random state tests for each skeletons -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG std::size_t nRandomItr = 2; #else std::size_t nRandomItr = 10; @@ -2021,7 +2021,7 @@ void DynamicsTest::testCenterOfMassFreeFall(const common::Uri& uri) auto dof = skel->getNumDofs(); if (nullptr == rootFreeJoint || !skel->isMobile() || 0 == dof) { -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG dtmsg << "Skipping COM free fall test for Skeleton [" << skel->getName() << "] since the Skeleton doesn't have FreeJoint at the root body " << " or immobile." << endl; @@ -2090,7 +2090,7 @@ void DynamicsTest::testConstraintImpulse(const common::Uri& uri) //---------------------------- Settings -------------------------------------- // Number of random state tests for each skeletons -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG std::size_t nRandomItr = 1; #else std::size_t nRandomItr = 1; @@ -2177,7 +2177,7 @@ void DynamicsTest::testImpulseBasedDynamics(const common::Uri& uri) //---------------------------- Settings -------------------------------------- // Number of random state tests for each skeletons -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG std::size_t nRandomItr = 1; #else std::size_t nRandomItr = 100; @@ -2260,7 +2260,7 @@ void DynamicsTest::testImpulseBasedDynamics(const common::Uri& uri) TEST_F(DynamicsTest, testJacobians) { for (std::size_t i = 0; i < getList().size(); ++i) { -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG dtdbg << getList()[i].toString() << std::endl; #endif testJacobians(getList()[i]); @@ -2271,7 +2271,7 @@ TEST_F(DynamicsTest, testJacobians) TEST_F(DynamicsTest, testFiniteDifference) { for (std::size_t i = 0; i < getList().size(); ++i) { -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG dtdbg << getList()[i].toString() << std::endl; #endif testFiniteDifferenceGeneralizedCoordinates(getList()[i]); @@ -2284,7 +2284,7 @@ TEST_F(DynamicsTest, testFiniteDifference) TEST_F(DynamicsTest, testForwardKinematics) { for (std::size_t i = 0; i < getList().size(); ++i) { -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG dtdbg << getList()[i].toString() << std::endl; #endif testForwardKinematics(getList()[i]); @@ -2295,7 +2295,7 @@ TEST_F(DynamicsTest, testForwardKinematics) TEST_F(DynamicsTest, testInverseDynamics) { for (std::size_t i = 0; i < getList().size(); ++i) { -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG dtdbg << getList()[i].toString() << std::endl; #endif testInverseDynamics(getList()[i]); @@ -2321,7 +2321,7 @@ TEST_F(DynamicsTest, compareEquationsOfMotion) } //////////////////////////////////////////////////////////////////////////// -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG dtdbg << getList()[i].toString() << std::endl; #endif compareEquationsOfMotion(getList()[i]); @@ -2332,7 +2332,7 @@ TEST_F(DynamicsTest, compareEquationsOfMotion) TEST_F(DynamicsTest, testCenterOfMass) { for (std::size_t i = 0; i < getList().size(); ++i) { -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG dtdbg << getList()[i].toString() << std::endl; #endif testCenterOfMass(getList()[i]); @@ -2343,7 +2343,7 @@ TEST_F(DynamicsTest, testCenterOfMass) TEST_F(DynamicsTest, testCenterOfMassFreeFall) { for (std::size_t i = 0; i < getList().size(); ++i) { -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG dtdbg << getList()[i].toString() << std::endl; #endif testCenterOfMassFreeFall(getList()[i]); @@ -2354,7 +2354,7 @@ TEST_F(DynamicsTest, testCenterOfMassFreeFall) TEST_F(DynamicsTest, testConstraintImpulse) { for (std::size_t i = 0; i < getList().size(); ++i) { -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG dtdbg << getList()[i].toString() << std::endl; #endif testConstraintImpulse(getList()[i]); @@ -2365,7 +2365,7 @@ TEST_F(DynamicsTest, testConstraintImpulse) TEST_F(DynamicsTest, testImpulseBasedDynamics) { for (std::size_t i = 0; i < getList().size(); ++i) { -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG dtdbg << getList()[i].toString() << std::endl; #endif testImpulseBasedDynamics(getList()[i]); @@ -2377,7 +2377,7 @@ TEST_F(DynamicsTest, HybridDynamics) { const double tol = 1e-8; const double timeStep = 1e-3; -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG const std::size_t numFrames = 50; // 0.05 secs #else const std::size_t numFrames = 5e+3; // 5 secs diff --git a/tests/integration/test_IkFast.cpp b/tests/integration/test_IkFast.cpp index 6876aa59d90ad..f608eac09d7df 100644 --- a/tests/integration/test_IkFast.cpp +++ b/tests/integration/test_IkFast.cpp @@ -134,7 +134,7 @@ TEST(IkFast, LoadWamArmIk) ik->setHierarchyLevel(1); std::stringstream ss; ss << DART_SHARED_LIB_PREFIX << "GeneratedWamIkFast"; -#if (DART_OS_LINUX || DART_OS_MACOS) && DART_BUILD_MODE_DEBUG +#if (DART_OS_LINUX || DART_OS_MACOS) && !defined(NDEBUG) ss << "d"; #endif ss << "." << DART_SHARED_LIB_EXTENSION; diff --git a/tests/integration/test_Joints.cpp b/tests/integration/test_Joints.cpp index 05fecf636b3b4..189410e55be9c 100644 --- a/tests/integration/test_Joints.cpp +++ b/tests/integration/test_Joints.cpp @@ -455,7 +455,7 @@ TEST_F(JOINTS, POSITION_LIMIT) joint1->setPositionLowerLimit(0, -limit1); joint1->setPositionUpperLimit(0, limit1); -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG double simTime = 0.2; #else double simTime = 2.0; @@ -535,7 +535,7 @@ TEST_F(JOINTS, POSITION_AND_VELOCITY_LIMIT) joint1->setVelocityLowerLimit(0, -velLimit1); joint1->setVelocityUpperLimit(0, velLimit1); -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG double simTime = 0.2; #else double simTime = 2.0; @@ -694,7 +694,7 @@ void testJointCoulombFrictionForce(double _timeStep) EXPECT_EQ(joint0->getCoulombFriction(0), frictionForce); EXPECT_EQ(joint1->getCoulombFriction(0), frictionForce); -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG double simTime = 0.2; #else double simTime = 2.0; @@ -950,7 +950,7 @@ void testServoMotor() for (auto pendulum : pendulums) world->addSkeleton(pendulum); -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG double simTime = 0.2; #else double simTime = 2.0; @@ -1073,7 +1073,7 @@ void testMimicJoint() world->addSkeleton(pendulum); -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG double simTime = 0.2; #else double simTime = 2.0; @@ -1159,7 +1159,7 @@ TEST_F(JOINTS, JOINT_COULOMB_FRICTION_AND_POSITION_LIMIT) EXPECT_EQ(joint0->getCoulombFriction(0), frictionForce); EXPECT_EQ(joint1->getCoulombFriction(0), frictionForce); -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG double simTime = 0.2; #else double simTime = 2.0; diff --git a/tests/integration/test_MetaSkeleton.cpp b/tests/integration/test_MetaSkeleton.cpp index 801a71543892c..32df4bb840161 100644 --- a/tests/integration/test_MetaSkeleton.cpp +++ b/tests/integration/test_MetaSkeleton.cpp @@ -105,7 +105,7 @@ TEST(MetaSkeleton, Referential) { std::vector skeletons = getSkeletons(); -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG std::size_t numIterations = 1; #else // Release mode std::size_t numIterations = 20; diff --git a/tests/integration/test_MultiObjectiveOptimization.cpp b/tests/integration/test_MultiObjectiveOptimization.cpp index 75e5ff6eebd64..3c51090ac467f 100644 --- a/tests/integration/test_MultiObjectiveOptimization.cpp +++ b/tests/integration/test_MultiObjectiveOptimization.cpp @@ -101,12 +101,12 @@ class Func2 : public Function //============================================================================== void testZDT1(MultiObjectiveSolver& solver) { -#if DART_BUILD_MODE_RELEASE +#ifdef NDEBUG std::size_t numSolutions = 50; #else std::size_t numSolutions = 10; #endif -#if DART_BUILD_MODE_RELEASE +#ifdef NDEBUG std::size_t iterationNum = 1000; #else std::size_t iterationNum = 200; @@ -137,12 +137,12 @@ void testZDT1Generic(MultiObjectiveSolver& solver) pFuncs.push_back(pFunc1); pFuncs.push_back(pFunc2); -#if DART_BUILD_MODE_RELEASE +#ifdef NDEBUG std::size_t numSolutions = 50; #else std::size_t numSolutions = 10; #endif -#if DART_BUILD_MODE_RELEASE +#ifdef NDEBUG std::size_t iterationNum = 1000; #else std::size_t iterationNum = 200; diff --git a/tests/integration/test_Skeleton.cpp b/tests/integration/test_Skeleton.cpp index df991d1940171..76d4124ff3116 100644 --- a/tests/integration/test_Skeleton.cpp +++ b/tests/integration/test_Skeleton.cpp @@ -109,7 +109,7 @@ TEST(Skeleton, Restructuring) { std::vector skeletons = getSkeletons(); -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG std::size_t numIterations = 10; #else std::size_t numIterations = 2 * skeletons.size(); @@ -631,7 +631,7 @@ TEST(Skeleton, NodePersistence) // The Node has been removed, so no reference to it will exist in the // Skeleton -#if DART_BUILD_MODE_RELEASE +#ifdef NDEBUG EXPECT_NE(skel->getEndEffector("manip"), manip); EXPECT_EQ(skel->getEndEffector("manip"), nullptr); @@ -639,7 +639,7 @@ TEST(Skeleton, NodePersistence) EXPECT_EQ(skel->getEndEffector(0), nullptr); #endif // Release Mode -#if DART_BUILD_MODE_RELEASE +#ifdef NDEBUG // But it will not remain in the BodyNode's indexing. // Note: We should only run this test in release mode, because otherwise it // will trigger an assertion. @@ -703,7 +703,7 @@ TEST(Skeleton, NodePersistence) // The Node has been removed, so no reference to it will exist in the // Skeleton -#if DART_BUILD_MODE_RELEASE +#ifdef NDEBUG EXPECT_NE(skel->getNode("node"), node); EXPECT_EQ(skel->getNode("node"), nullptr); @@ -711,7 +711,7 @@ TEST(Skeleton, NodePersistence) EXPECT_EQ(skel->getNode(0), nullptr); #endif // Release Mode -#if DART_BUILD_MODE_RELEASE +#ifdef NDEBUG // But it will not remain in the BodyNode's indexing. // Note: We should only run this test in release mode, because otherwise it // will trigger an assertion. diff --git a/tests/integration/test_SoftDynamics.cpp b/tests/integration/test_SoftDynamics.cpp index 2ea4dda4bb594..52df635cd5d7b 100644 --- a/tests/integration/test_SoftDynamics.cpp +++ b/tests/integration/test_SoftDynamics.cpp @@ -236,7 +236,7 @@ void SoftDynamicsTest::compareEquationsOfMotion(const std::string& _fileName) //---------------------------- Settings -------------------------------------- // Number of random state tests for each skeletons -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG std::size_t nRandomItr = 1; #else std::size_t nRandomItr = 1; @@ -430,7 +430,7 @@ TEST_F(SoftDynamicsTest, compareEquationsOfMotion) // for (int i = 0; i < getList().size(); ++i) // { - // #if DART_BUILD_MODE_DEBUG + // #ifndef NDEBUG // dtdbg << getList()[i] << std::endl; // #endif // compareEquationsOfMotion(getList()[i]); diff --git a/tests/integration/test_World.cpp b/tests/integration/test_World.cpp index 74d0949b1d1e2..201106d4602db 100644 --- a/tests/integration/test_World.cpp +++ b/tests/integration/test_World.cpp @@ -223,7 +223,7 @@ TEST(World, Cloning) for (std::size_t j = 1; j < 5; ++j) clones.push_back(clones[j - 1]->clone()); -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG std::size_t numIterations = 3; #else std::size_t numIterations = 500; diff --git a/tests/regression/test_Issue1184.cpp b/tests/regression/test_Issue1184.cpp index 2cd8447cd2ef9..5290f3544a4b2 100644 --- a/tests/regression/test_Issue1184.cpp +++ b/tests/regression/test_Issue1184.cpp @@ -79,7 +79,7 @@ TEST(Issue1184, Accuracy) return std::make_shared(s); }; -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG const auto groundInfoFunctions = {makePlaneGround}; const auto objectShapeFunctions = {makeSphereObject}; const auto halfsizes = {10.0}; diff --git a/tests/regression/test_Issue1596.cpp b/tests/regression/test_Issue1596.cpp index a594a4ec36983..52a57e758f4fc 100644 --- a/tests/regression/test_Issue1596.cpp +++ b/tests/regression/test_Issue1596.cpp @@ -40,7 +40,7 @@ //======================================================================================== TEST(Issue1596, ServoJointWithPositionLimits) { -#if DART_BUILD_MODE_RELEASE +#ifdef NDEBUG const auto num_steps = 50000; #else const auto num_steps = 1000; diff --git a/tests/unit/common/test_MemoryManager.cpp b/tests/unit/common/test_MemoryManager.cpp index 2e1e57586b6a1..237331049e512 100644 --- a/tests/unit/common/test_MemoryManager.cpp +++ b/tests/unit/common/test_MemoryManager.cpp @@ -63,7 +63,7 @@ TEST(MemoryManagerTest, Allocate) // Allocate 1 byte using FreeListAllocator auto ptr1 = mm.allocateUsingFree(1); EXPECT_NE(ptr1, nullptr); -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG EXPECT_TRUE(mm.hasAllocated(ptr1, 1)); EXPECT_FALSE(mm.hasAllocated(nullptr, 1)); EXPECT_FALSE(mm.hasAllocated(ptr1, 1 * 2)); @@ -72,7 +72,7 @@ TEST(MemoryManagerTest, Allocate) // Allocate 1 byte using PoolAllocator auto ptr2 = mm.allocateUsingPool(1); EXPECT_NE(ptr2, nullptr); -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG EXPECT_TRUE(mm.hasAllocated(ptr2, 1)); EXPECT_FALSE(mm.hasAllocated(nullptr, 1)); EXPECT_FALSE(mm.hasAllocated(ptr2, 1 * 2)); diff --git a/tests/unit/math/test_Math.cpp b/tests/unit/math/test_Math.cpp index 8d3b5fd1b0ad9..ecb7bd37721e7 100644 --- a/tests/unit/math/test_Math.cpp +++ b/tests/unit/math/test_Math.cpp @@ -1335,7 +1335,7 @@ typename Derived::PlainObject AdTJac3( //============================================================================== TEST(MATH, PerformanceComparisonOfAdTJac) { -#if DART_BUILD_MODE_DEBUG +#ifndef NDEBUG int testCount = 1e+2; #else int testCount = 1e+6;