Skip to content
Snippets Groups Projects
Commit 3482cca1 authored by Brandon Lai-Cheong's avatar Brandon Lai-Cheong
Browse files

fixed tests

parent 8877f55d
No related branches found
No related tags found
No related merge requests found
...@@ -42,7 +42,6 @@ add_executable( ...@@ -42,7 +42,6 @@ add_executable(
tests/edge_union_cases.cpp tests/edge_union_cases.cpp
tests/unit_tests/convex_triangulation_tests.cpp tests/unit_tests/convex_triangulation_tests.cpp
src/utilities/convex_triangulation.cpp src/utilities/convex_triangulation.cpp
tests/unit_tests/edge_direction_intr_tests.cpp
tests/unit_tests/contourize_tests.cpp tests/unit_tests/contourize_tests.cpp
src/debug_utilities/print_triangles.cpp src/debug_utilities/print_triangles.cpp
src/utilities/split_triangle.cpp src/utilities/split_triangle.cpp
......
...@@ -26,7 +26,7 @@ TEST(UnionTests, TwoIntersections) ...@@ -26,7 +26,7 @@ TEST(UnionTests, TwoIntersections)
std::vector<Triangle> expected{ std::vector<Triangle> expected{
Triangle({6,1,1}, {4,3,1}, {3.333333,1.66666,1}, 2), Triangle({6,1,1}, {4,3,1}, {3.333333,1.66666,1}, 2),
Triangle({4,3,1}, {3.33333,1.66667,1}, {4,1,1},2), Triangle({6,1,1}, {3.33333,1.66667,1}, {4,1,1},2),
Triangle({0,0}, {5,0}, {2,3}, 1)}; Triangle({0,0}, {5,0}, {2,3}, 1)};
EXPECT_EQ(ts, expected); EXPECT_EQ(ts, expected);
} }
...@@ -142,4 +142,4 @@ TEST(UnionTests, StarTest) ...@@ -142,4 +142,4 @@ TEST(UnionTests, StarTest)
TEST (UnionTests, DepthTest) { TEST (UnionTests, DepthTest) {
} }
\ No newline at end of file
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
#include <intersections.h> #include <intersections.h>
TEST(ContourizeTest, Simple) { TEST(ContourizeTest, Simple) {
std::vector<Point> points{{0,0}, {0,5}, {2, 3}}; std::vector<Point> points{{0,0}, {5,0}, {2, 3}};
auto result = contourize(points); auto result = contourize(points);
std::vector<Point> expected{{0,0}, {0,5}, {2, 3}}; std::vector<Point> expected{{0,0}, {5,0}, {2, 3}};
EXPECT_EQ(result, expected); EXPECT_EQ(result, expected);
} }
...@@ -35,4 +35,4 @@ TEST(ContourizeTest, TestCase3) { ...@@ -35,4 +35,4 @@ TEST(ContourizeTest, TestCase3) {
std::vector<Point> expected{{3,1}, {4,1}, {3.33333, 1.6666}}; std::vector<Point> expected{{3,1}, {4,1}, {3.33333, 1.6666}};
EXPECT_EQ(result, expected); EXPECT_EQ(result, expected);
}*/ }*/
\ No newline at end of file
#include <intersections.h>
#include <gtest/gtest.h>
#include <edge.h>
TEST(EdgeDirectionIntersectionTests, BasicTests) {
Edge e1{ {5,0}, {2,3}};
Edge e2{{3,1}, {6,1}};
auto result = intersectionWithinEdgeDirection(e1, e2);
ASSERT_TRUE(result.has_value());
Point expected = Point{4,1};
EXPECT_EQ(result.value(), expected);
Edge e3{{4,3}, {3,1}};
auto result2 = intersectionWithinEdgeDirection(e3, e1);
ASSERT_TRUE(result2.has_value());
Point expected2 = Point{3.33333,1.66667};
EXPECT_EQ(result2.value(), expected2);
Edge e4{{3,1}, {4,3}};
Edge e5{{0,0}, {5,0}};
auto result3 = intersectionWithinEdgeDirection(e4, e5);
EXPECT_FALSE(result3.has_value()) << result3.value();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment