PlayRho
1.1.0
An Interactive Real-Time-Oriented C++ Physics Engine & Library
|
|
This is the googletest
based unit testing file for the interfaces to playrho::d2::Body
.
#include "UnitTests.hpp"
#include <PlayRho/Dynamics/Body.hpp>
{
case 4:
#if defined(_WIN64)
#if !defined(NDEBUG)
EXPECT_EQ(
sizeof(
Body), std::size_t(216));
#else
EXPECT_EQ(
sizeof(
Body), std::size_t(100));
#endif
#elif defined(_WIN32)
#if !defined(NDEBUG)
EXPECT_EQ(
sizeof(
Body), std::size_t(192));
#else
EXPECT_EQ(
sizeof(
Body), std::size_t(100));
#endif
#else
EXPECT_EQ(
sizeof(
Body), std::size_t(100));
#endif
break;
case 8:
EXPECT_EQ(
sizeof(
Body), std::size_t(200));
break;
case 16:
EXPECT_EQ(
sizeof(
Body), std::size_t(400));
break;
default:
FAIL();
break;
}
}
TEST(
Body, GetFlagsForBodyType)
{
}
TEST(
Body, GetFlagsForBodyConf)
{
EXPECT_TRUE(
}
TEST(
Body, LinearDampingOnConstruction)
{
}
TEST(
Body, AngularDampingOnConstruction)
{
}
TEST(
Body, InvMassOnConstruction)
{
}
TEST(
Body, TransformationOnConstruction)
{
EXPECT_EQ(
EXPECT_EQ(
}
TEST(
Body, VelocityOnConstruction)
{
EXPECT_EQ(
EXPECT_EQ(
}
TEST(
Body, AccelerationOnConstruction)
{
body.GetLinearAcceleration());
body.GetAngularAcceleration());
}
TEST(
Body, EqualsOperator)
{
{
EXPECT_TRUE(body ==
Body());
}
{
EXPECT_TRUE(body1 == body2);
}
{
EXPECT_FALSE(body ==
Body());
}
{
EXPECT_FALSE(body ==
Body());
}
{
EXPECT_FALSE(body ==
Body());
}
{
EXPECT_FALSE(body ==
Body());
}
{
EXPECT_FALSE(body1 == body2);
}
{
EXPECT_FALSE(body ==
Body());
}
{
EXPECT_FALSE(body ==
Body());
}
{
EXPECT_FALSE(body ==
Body());
}
{
EXPECT_FALSE(body ==
Body());
}
{
body1.SetUnderActiveTime(2_s);
EXPECT_FALSE(body1 == body2);
}
}
TEST(
Body, NotEqualsOperator)
{
{
EXPECT_FALSE(body !=
Body());
}
{
EXPECT_FALSE(body1 != body2);
}
{
EXPECT_TRUE(body !=
Body());
}
{
EXPECT_TRUE(body !=
Body());
}
{
EXPECT_TRUE(body !=
Body());
}
{
EXPECT_TRUE(body !=
Body());
}
{
EXPECT_TRUE(body1 != body2);
}
{
EXPECT_TRUE(body !=
Body());
}
{
EXPECT_TRUE(body !=
Body());
}
{
EXPECT_TRUE(body !=
Body());
}
{
EXPECT_TRUE(body !=
Body());
}
{
body1.SetUnderActiveTime(2_s);
EXPECT_TRUE(body1 != body2);
}
}
@ Static
Static body type.
@ e_accelerationFlag
Acceleration flag.
Definition: Body.hpp:105
constexpr auto RadianPerSquareSecond
Radian per square second unit of angular acceleration.
Definition: Units.hpp:394
constexpr BodyConf & UseType(BodyType t) noexcept
Use the given type.
Definition: BodyConf.hpp:166
Name space for 2-dimensionally related PlayRho names.
Definition: AABB.cpp:34
2-D unit vector.
Definition: UnitVec.hpp:50
@ e_impenetrableFlag
Impenetrable flag.
Definition: Body.hpp:89
void SetType(BodyType value) noexcept
Sets the type of this body.
Definition: Body.cpp:124
void SetInvRotInertia(InvRotInertia v) noexcept
Sets the inverse rotational inertia.
Definition: Body.hpp:228
void SetVelocity(const Velocity &velocity) noexcept
Sets the body's velocity (linear and angular velocity).
Definition: Body.cpp:165
constexpr BodyConf & UseAwake(bool value) noexcept
Use the given awake value.
Definition: BodyConf.hpp:246
Name space for all PlayRho related names.
Definition: AABB.cpp:33
static FlagsType GetFlags(BodyType type) noexcept
Gets the flags for the given value.
Definition: Body.cpp:41
constexpr BodyConf & UseFixedRotation(bool value) noexcept
Use the given fixed rotation state.
Definition: BodyConf.hpp:252
AngularVelocity angular
Angular velocity.
Definition: Velocity.hpp:40
void SetMass(Body &body, Mass mass)
Sets the mass of the given body.
Definition: Body.hpp:1090
Physical entity that exists within a World.
Definition: Body.hpp:71
Frequency GetLinearDamping(const Body &body) noexcept
Gets the linear damping of the body.
Definition: Body.hpp:987
constexpr BodyConf & UseLocation(Length2 l) noexcept
Use the given location.
Definition: BodyConf.hpp:172
constexpr BodyConf & UseLinearAcceleration(LinearAcceleration2 v) noexcept
Use the given linear acceleration.
Definition: BodyConf.hpp:204
Frequency GetAngularDamping(const Body &body) noexcept
Gets the angular damping of the body.
Definition: Body.hpp:1003
void SetAcceleration(LinearAcceleration2 linear, AngularAcceleration angular) noexcept
Sets the linear and rotational accelerations on this body.
Definition: Body.cpp:177
LinearVelocity2 linear
Linear velocity.
Definition: Velocity.hpp:39
Description of a "sweep" of motion in 2-D space.
Definition: Sweep.hpp:42
float Real
Real-number type.
Definition: Real.hpp:69
Configuration for a body.
Definition: BodyConf.hpp:50
2-D velocity related data structure.
Definition: Velocity.hpp:38
constexpr BodyConf & UseAngularDamping(NonNegative< Frequency > v) noexcept
Use the given angular damping.
Definition: BodyConf.hpp:228
@ e_velocityFlag
Velocity flag.
Definition: Body.hpp:100
void SetTransformation(const Transformation &value) noexcept
Sets the body's transformation.
Definition: Body.hpp:519
constexpr auto SquareRadian
Square radian unit type.
Definition: Units.hpp:379
2-D positional data structure.
Definition: Position.hpp:37
Vector.
Definition: Vector.hpp:49
void SetSweep(const Sweep &value) noexcept
Sets the sweep value of the given body.
Definition: Body.hpp:389
AngularAcceleration GetAngularAcceleration(const Body &body) noexcept
Gets this body's angular acceleration.
Definition: Body.hpp:1048
constexpr BodyConf & Use(Position v) noexcept
Use the given position for the linear and angular positions.
Definition: BodyConf.hpp:184
constexpr Transformation GetTransformation(const Length2 ctr, const UnitVec rot, const Length2 localCtr) noexcept
Gets the transformation for the given values.
Definition: Math.hpp:875
InvMass GetInvMass(const Body &body) noexcept
Gets the inverse total mass of the body.
Definition: Body.hpp:967
constexpr BodyConf & UseLinearDamping(NonNegative< Frequency > v) noexcept
Use the given linear damping.
Definition: BodyConf.hpp:222
@ e_fixedRotationFlag
Fixed rotation flag.
Definition: Body.hpp:92
void SetLinearDamping(Body &body, NonNegative< Frequency > value) noexcept
Sets the linear damping of the body.
Definition: Body.hpp:995
Velocity GetVelocity(const Body &body, Time h) noexcept
Gets the velocity of the body after the given time accounting for the body's acceleration and capped ...
Definition: Body.cpp:221
void JustSetVelocity(Velocity value) noexcept
Sets the body's velocity.
Definition: Body.hpp:179
LinearAcceleration2 GetLinearAcceleration(const Body &body) noexcept
Gets this body's linear acceleration.
Definition: Body.hpp:1040
@ e_awakeFlag
Awake flag.
Definition: Body.hpp:81
void SetAngularDamping(Body &body, NonNegative< Frequency > value) noexcept
Sets the angular damping of the body.
Definition: Body.hpp:1011