"""Tests para alpha_shape_concave_hull."""

import sys
import os

sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
from alpha_shape_concave_hull import alpha_shape_concave_hull


def test_alpha_shape_square_large_alpha():
    """4 corner points with large alpha should return a geometry."""
    pts = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 1.0)]
    result = alpha_shape_concave_hull(pts, alpha=10.0)
    assert result is not None


def test_alpha_shape_too_few_points():
    result = alpha_shape_concave_hull([(0, 0), (1, 0), (0, 1)], alpha=10.0)
    assert result is None


def test_alpha_shape_very_small_alpha_returns_none():
    """Alpha so small that no triangle circumradius fits."""
    pts = [(0.0, 0.0), (100.0, 0.0), (100.0, 100.0), (0.0, 100.0)]
    result = alpha_shape_concave_hull(pts, alpha=0.0001)
    assert result is None


def test_alpha_shape_5_points_returns_geometry():
    pts = [
        (0.0, 0.0),
        (2.0, 0.0),
        (2.0, 2.0),
        (0.0, 2.0),
        (1.0, 1.0),
    ]
    result = alpha_shape_concave_hull(pts, alpha=5.0)
    assert result is not None
