"""Tests para haversine_km."""

import os
import sys

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

from python.functions.geo.haversine_km import haversine_km


def test_madrid_barcelona_aproximado():
    d = haversine_km(-3.7038, 40.4168, 2.1686, 41.3874)
    assert abs(d - 504.0) < 2.0, f"Esperado ~504 km, got {d:.1f}"


def test_misma_coordenada_es_cero():
    d = haversine_km(0.0, 0.0, 0.0, 0.0)
    assert d == 0.0, f"Misma coordenada debe ser 0, got {d}"
