New tests !

Former-commit-id: 1cb5949ce7b9fde74189a37c75f0b3380fda95c7
This commit is contained in:
Gawaboumga
2015-12-30 15:38:52 +01:00
parent 139c495966
commit 15e4fe1453
15 changed files with 399 additions and 33 deletions

View File

@@ -32,6 +32,22 @@ SCENARIO("Quaternion", "[MATH][QUATERNION]")
REQUIRE((firstQuaternion * Nz::Vector3f::UnitZ()) == -Nz::Vector3f::UnitZ());
}
}
WHEN("We invert or normalize Zero quaternion")
{
Nz::Quaternionf zero = Nz::Quaternionf::Zero();
THEN("It's meant not to be changed")
{
Nz::Quaternionf inverted = zero.GetInverse();
float tmp = -1.f;
Nz::Quaternionf normalized = zero.GetNormal(&tmp);
REQUIRE(inverted == zero);
REQUIRE(normalized == zero);
REQUIRE(tmp == Approx(0.f));
}
}
}
GIVEN("The four unit quaternions")
@@ -154,5 +170,18 @@ SCENARIO("Quaternion", "[MATH][QUATERNION]")
REQUIRE(quaternionC.z == Approx(unitZ225.z));
}
}
WHEN("We get the rotation between two vectors")
{
/*TODO
* Nz::Quaternionf rotationBetweenXY = Nz::Quaternionf::RotationBetween(Nz::Vector3f::UnitX(), Nz::Vector3f::UnitY());
THEN("The rotation in left-handed is 270 degree on z")
{
Nz::Quaternionf rotation270Z(Nz::FromDegrees(270.f), Nz::Vector3f::UnitZ());
Nz::Quaternionf rotation90Z(Nz::FromDegrees(90.f), Nz::Vector3f::UnitZ());
REQUIRE(rotation90Z == rotationBetweenXY);
}*/
}
}
}