22 lines
568 B
C++
22 lines
568 B
C++
#include <gtest/gtest.h>
|
|
#include "vde/core/convex_hull.h"
|
|
|
|
using namespace vde::core;
|
|
|
|
TEST(ConvexHullTest, ThreePoints_ReturnsTriangle) {
|
|
std::vector<Point2D> pts = {{0,0}, {1,0}, {0,1}};
|
|
auto hull = convex_hull_2d(pts);
|
|
EXPECT_EQ(hull.size(), 3u);
|
|
}
|
|
|
|
TEST(ConvexHullTest, CollinearPoints_ReturnsEndpoints) {
|
|
std::vector<Point2D> pts = {{0,0}, {1,1}, {2,2}, {3,3}};
|
|
auto hull = convex_hull_2d(pts);
|
|
EXPECT_GE(hull.size(), 2u);
|
|
}
|
|
|
|
TEST(ConvexHullTest, Empty_ReturnsEmpty) {
|
|
auto hull = convex_hull_2d({});
|
|
EXPECT_TRUE(hull.empty());
|
|
}
|