New tests !
Former-commit-id: 1cb5949ce7b9fde74189a37c75f0b3380fda95c7
This commit is contained in:
@@ -59,5 +59,45 @@ SCENARIO("Sphere", "[MATH][SPHERE]")
|
||||
REQUIRE(centerUnitBox.GetSquaredBoundingSphere() == Nz::Spheref(Nz::Vector3f::Zero(), 0.75f));
|
||||
}
|
||||
}
|
||||
|
||||
WHEN("We ask for positive and negative vertex")
|
||||
{
|
||||
Nz::Vector3f positiveVector = Nz::Vector3f::UnitY();
|
||||
|
||||
THEN("Positive vertex should be the same with centered and unit sphere")
|
||||
{
|
||||
REQUIRE(positiveVector == firstCenterAndUnit.GetPositiveVertex(positiveVector));
|
||||
}
|
||||
|
||||
AND_THEN("Negative vertex should be the opposite")
|
||||
{
|
||||
REQUIRE(-positiveVector == firstCenterAndUnit.GetNegativeVertex(positiveVector));
|
||||
}
|
||||
}
|
||||
|
||||
WHEN("We extend the unit sphere to one point")
|
||||
{
|
||||
Nz::Vector3f point = Nz::Vector3f::UnitY() * 2.f;
|
||||
|
||||
firstCenterAndUnit.ExtendTo(point);
|
||||
|
||||
THEN("Sphere must contain it and distance should be good")
|
||||
{
|
||||
CHECK(firstCenterAndUnit.Contains(point));
|
||||
REQUIRE(firstCenterAndUnit.Distance(point) == 2.f);
|
||||
}
|
||||
}
|
||||
|
||||
WHEN("We try to lerp")
|
||||
{
|
||||
THEN("Compilation should be fine")
|
||||
{
|
||||
Nz::Spheref nullRect = Nz::Spheref::Zero();
|
||||
Nz::Spheref centerAndUnit = firstCenterAndUnit;
|
||||
Nz::Spheref result(Nz::Vector3f::Zero(), 0.5f);
|
||||
|
||||
REQUIRE(Nz::Spheref::Lerp(nullRect, centerAndUnit, 0.5f) == result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user