"""Tests para point_in_polygon."""

import os
import sys

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

from python.functions.geo.point_in_polygon import point_in_polygon

OUTER = [(0.0, 0.0), (4.0, 0.0), (4.0, 4.0), (0.0, 4.0)]
HOLE  = [(1.0, 1.0), (3.0, 1.0), (3.0, 3.0), (1.0, 3.0)]


def test_punto_en_exterior():
    # Punto en el anillo exterior, fuera del hole
    assert point_in_polygon(0.5, 0.5, [OUTER, HOLE]) is True


def test_punto_en_hole():
    # Punto dentro del hole → False
    assert point_in_polygon(2.0, 2.0, [OUTER, HOLE]) is False


def test_punto_fuera():
    assert point_in_polygon(10.0, 10.0, [OUTER, HOLE]) is False


def test_poligono_vacio():
    assert point_in_polygon(0.5, 0.5, []) is False
