recastnavigation/Tests/Detour/Tests_Detour.cpp
azw 0165dc279d
Some checks failed
Build / macOS-premake (Debug) (push) Has been cancelled
Build / macOS-premake (Release) (push) Has been cancelled
Build / macos-cmake (Debug) (push) Has been cancelled
Build / macos-cmake (Release) (push) Has been cancelled
Build / linux-premake (clang, debug) (push) Has been cancelled
Build / linux-premake (clang, release) (push) Has been cancelled
Build / linux-premake (gcc, debug) (push) Has been cancelled
Build / linux-premake (gcc, release) (push) Has been cancelled
Build / linux-cmake (Debug) (push) Has been cancelled
Build / linux-cmake (Release) (push) Has been cancelled
Build / windows-premake (Debug, windows-2019, 16.0, vs2019) (push) Has been cancelled
Build / windows-premake (Debug, windows-2022, 17.0, vs2022) (push) Has been cancelled
Build / windows-premake (Release, windows-2019, 16.0, vs2019) (push) Has been cancelled
Build / windows-premake (Release, windows-2022, 17.0, vs2022) (push) Has been cancelled
Build / windows-cmake (Visual Studio 16 2019, Debug, windows-2019, vs2019) (push) Has been cancelled
Build / windows-cmake (Visual Studio 16 2019, Release, windows-2019, vs2019) (push) Has been cancelled
Build / windows-cmake (Visual Studio 17 2022, Debug, windows-2022, vs2022) (push) Has been cancelled
Build / windows-cmake (Visual Studio 17 2022, Release, windows-2022, vs2022) (push) Has been cancelled
Tests / macos-tests (push) Has been cancelled
Tests / linux-tests (push) Has been cancelled
Tests / windows-tests (push) Has been cancelled
1
2022-11-28 18:34:23 +08:00

34 lines
848 B
C++

#include "catch_amalgamated.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] == Catch::Approx(0));
REQUIRE(out[1] == Catch::Approx(0));
REQUIRE(out[2] == Catch::Approx(1));
dtRandomPointInConvexPoly(pts, npts, areas, 0.5f, 1.0f, out);
REQUIRE(out[0] == Catch::Approx(1.0f / 2));
REQUIRE(out[1] == Catch::Approx(0));
REQUIRE(out[2] == Catch::Approx(1.0f / 2));
dtRandomPointInConvexPoly(pts, npts, areas, 1.0f, 1.0f, out);
REQUIRE(out[0] == Catch::Approx(1));
REQUIRE(out[1] == Catch::Approx(0));
REQUIRE(out[2] == Catch::Approx(0));
}
}