Triangles/src/unittest/test_helpers.cpp
Stephen Seo 2919be2aff WIP Replace SFML with Raylib
Need to fix Raygui usage in helpers.hpp.
Need to fix triangles being drawn flipped over the x-axis.
2021-03-29 17:05:27 +09:00

18 lines
497 B
C++

#include "catch.hpp"
#include "helpers.hpp"
#include "triangle.hpp"
TEST_CASE("Test is_within_shape", "[Triangles]") {
Tri::Triangle triangle({{
{0.0f, 10.0f},
{10.0f, 10.0f},
{10.0f, 0.0f}
}});
CHECK(Tri::is_within_shape(triangle, {2.0f, 2.0f}) == false);
CHECK(Tri::is_within_shape(triangle, {5.0f, 15.0f}) == false);
CHECK(Tri::is_within_shape(triangle, {15.0f, 5.0f}) == false);
CHECK(Tri::is_within_shape(triangle, {7.0f, 7.0f}) == true);
}