UnitTest: Add some checks

This commit is contained in:
Lynix 2017-04-22 15:08:21 +02:00
parent 06038a4d81
commit d8a2d08e27
2 changed files with 26 additions and 2 deletions

View File

@ -1,5 +1,6 @@
#include <Nazara/Math/Algorithm.hpp>
#include <Catch/catch.hpp>
#include <limits>
TEST_CASE("Approach", "[MATH][ALGORITHM]")
{
@ -48,6 +49,11 @@ TEST_CASE("CountBits", "[MATH][ALGORITHM]")
{
REQUIRE(Nz::CountBits(0) == 0);
}
SECTION("Number 0xFFFFFFFF has 32 bit set to 1")
{
REQUIRE(Nz::CountBits(0xFFFFFFFF) == 32);
}
}
TEST_CASE("DegreeToRadian", "[MATH][ALGORITHM]")
@ -205,9 +211,19 @@ TEST_CASE("NumberEquals", "[MATH][ALGORITHM]")
CHECK(Nz::NumberEquals(2.35, 2.35, 0.01));
}
SECTION("3 and 4 unsigned should be the same at 1")
SECTION("0 and 4 unsigned should be the same at 1")
{
CHECK(Nz::NumberEquals(3U, 4U, 1U));
CHECK(Nz::NumberEquals(0U, 4U, 4U));
}
SECTION("Maximum integer and -1 should not be equal")
{
CHECK_FALSE(Nz::NumberEquals(std::numeric_limits<int>::max(), -1));
}
SECTION("Maximum integer and minimum integer should not be equal")
{
CHECK_FALSE(Nz::NumberEquals(std::numeric_limits<int>::max(), std::numeric_limits<int>::min()));
}
}

View File

@ -24,6 +24,14 @@ SCENARIO("EntityOwner", "[NDK][ENTITYOWNER]")
world.Update(1.f);
REQUIRE(!entity.IsValid());
}
THEN("Moving an entity owner works")
{
Ndk::EntityOwner entityOwner2(std::move(entityOwner));
entityOwner2.Reset();
world.Update(1.f);
REQUIRE(!entity.IsValid());
}
}
}
}