Lua tests (#158)

* Fix float comparison in tests

* Lua tests
This commit is contained in:
Gawaboumga
2018-01-31 15:27:23 +01:00
committed by Jérôme Leclercq
parent 7c1ffea19c
commit dfd28160a0
9 changed files with 595 additions and 5 deletions

View File

@@ -98,7 +98,7 @@ SCENARIO("Collider2D", "[PHYSICS2D][COLLIDER2D]")
THEN("We expect those to be true")
{
CHECK(segment.GetFirstPoint() == firstPoint);
CHECK(segment.GetLength() == firstPoint.Distance(secondPoint));
CHECK(segment.GetLength() == Approx(firstPoint.Distance(secondPoint)));
CHECK(segment.GetSecondPoint() == secondPoint);
CHECK(segment.GetType() == Nz::ColliderType2D_Segment);
}

View File

@@ -306,13 +306,13 @@ Nz::RigidBody2D CreateBody(Nz::PhysWorld2D& world)
void EQUALITY(const Nz::RigidBody2D& left, const Nz::RigidBody2D& right)
{
CHECK(left.GetAABB() == right.GetAABB());
CHECK(left.GetAngularVelocity() == right.GetAngularVelocity());
CHECK(left.GetAngularVelocity() == Approx(right.GetAngularVelocity()));
CHECK(left.GetCenterOfGravity() == right.GetCenterOfGravity());
CHECK(left.GetGeom() == right.GetGeom());
CHECK(left.GetHandle() != right.GetHandle());
CHECK(left.GetMass() == right.GetMass());
CHECK(left.GetMass() == Approx(right.GetMass()));
CHECK(left.GetPosition() == right.GetPosition());
CHECK(left.GetRotation() == right.GetRotation());
CHECK(left.GetRotation() == Approx(right.GetRotation()));
CHECK(left.GetUserdata() == right.GetUserdata());
CHECK(left.GetVelocity() == right.GetVelocity());
}