"""
Coverage tests for curve.py - untested branches.
"""

import pytest

# Constants for skip messages
SKIP_CURVE = "Curve operations not available"


# ========================================================================
# Curve operations branches
# ========================================================================


def test_point_addition():
    """Test elliptic curve point addition."""
    try:
        from bsv.curve import point_add

        # Test with identity points
        result = point_add((0, 0), (0, 0))
        assert result is not None
    except (ImportError, AttributeError):
        pytest.skip(SKIP_CURVE)


def test_point_multiplication():
    """Test elliptic curve point multiplication."""
    try:
        from bsv.curve import point_mul

        # Test with small scalar
        result = point_mul((0, 0), 1)
        assert result is not None
    except (ImportError, AttributeError):
        pytest.skip(SKIP_CURVE)


def test_point_doubling():
    """Test elliptic curve point doubling."""
    try:
        from bsv.curve import point_double

        result = point_double((0, 0))
        assert result is not None
    except (ImportError, AttributeError):
        pytest.skip(SKIP_CURVE)


def test_is_on_curve():
    """Test checking if point is on curve."""
    try:
        from bsv.curve import is_on_curve

        # Test with generator point
        result = is_on_curve((0, 0))
        assert isinstance(result, bool)
    except (ImportError, AttributeError):
        pytest.skip(SKIP_CURVE)


# ========================================================================
# Edge cases
# ========================================================================


def test_infinity_point():
    """Test handling of infinity point."""
    try:
        from bsv.curve import INFINITY

        assert INFINITY is not None
    except (ImportError, AttributeError):
        pytest.skip("INFINITY constant not available")


def test_generator_point():
    """Test generator point."""
    try:
        from bsv.curve import G

        assert G is not None
        assert len(G) == 2  # (x, y) coordinate
    except (ImportError, AttributeError):
        pytest.skip("Generator point not available")


def test_curve_order():
    """Test curve order constant."""
    try:
        from bsv.curve import N

        assert N > 0
    except (ImportError, AttributeError):
        pytest.skip("Curve order not available")


def test_curve_prime():
    """Test curve prime constant."""
    try:
        from bsv.curve import P

        assert P > 0
    except (ImportError, AttributeError):
        pytest.skip("Curve prime not available")
