mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-19 08:38:20 +00:00
Recast navigation
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
file(GLOB TESTS_SOURCES *.cpp Detour/*.cpp Recast/*.cpp)
|
||||
|
||||
include_directories(../Detour/Include)
|
||||
include_directories(../Recast/Include)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_executable(Tests ${TESTS_SOURCES})
|
||||
add_dependencies(Tests Recast Detour)
|
||||
target_link_libraries(Tests Recast Detour)
|
||||
add_test(Tests Tests)
|
||||
|
||||
install(TARGETS Tests RUNTIME DESTINATION bin)
|
||||
@@ -0,0 +1,33 @@
|
||||
#include "catch.hpp"
|
||||
|
||||
#include "DetourCommon.h"
|
||||
|
||||
TEST_CASE("dtRandomPointInConvexPoly")
|
||||
{
|
||||
SECTION("Properly works when the argument 's' is 1.0f")
|
||||
{
|
||||
const float pts[] = {
|
||||
0, 0, 0,
|
||||
0, 0, 1,
|
||||
1, 0, 0,
|
||||
};
|
||||
const int npts = 3;
|
||||
float areas[6];
|
||||
float out[3];
|
||||
|
||||
dtRandomPointInConvexPoly(pts, npts, areas, 0.0f, 1.0f, out);
|
||||
REQUIRE(out[0] == Approx(0));
|
||||
REQUIRE(out[1] == Approx(0));
|
||||
REQUIRE(out[2] == Approx(1));
|
||||
|
||||
dtRandomPointInConvexPoly(pts, npts, areas, 0.5f, 1.0f, out);
|
||||
REQUIRE(out[0] == Approx(1.0f / 2));
|
||||
REQUIRE(out[1] == Approx(0));
|
||||
REQUIRE(out[2] == Approx(1.0f / 2));
|
||||
|
||||
dtRandomPointInConvexPoly(pts, npts, areas, 1.0f, 1.0f, out);
|
||||
REQUIRE(out[0] == Approx(1));
|
||||
REQUIRE(out[1] == Approx(0));
|
||||
REQUIRE(out[2] == Approx(0));
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include "catch.hpp"
|
||||
Reference in New Issue
Block a user