#!/usr/bin/env python3
"""
Test to verify if long vowels are being properly detected and mapped
"""

import cadar


def test_simple_long_vowels():
    """Test simple long vowel characters"""

    print("Testing simple long vowel detection...")
    print("=" * 50)

    # Test simple long vowels
    test_cases = ["aa", "ii", "uu", "oo"]

    for case in test_cases:
        print(f"\nTesting: '{case}'")

        # Convert to Arabic
        arabic = cadar.bizi2ara(case)
        print(f"  Latin → Arabic: '{case}' → '{arabic}'")

        # Convert back
        back = cadar.ara2bizi(arabic)
        print(f"  Arabic → Latin: '{arabic}' → '{back}'")

        # Check roundtrip
        success = back == case
        print(f"  Roundtrip success: {success}")


def test_manually_created_double_chars():
    """Test manually created double Arabic characters"""

    print("\n\nTesting manually created double Arabic characters...")
    print("=" * 50)

    # Create double characters manually
    double_chars = ["اا", "يي", "وو"]

    for chars in double_chars:
        print(f"\nTesting: '{chars}'")

        # Convert to Latin
        latin = cadar.ara2bizi(chars)
        print(f"  Arabic → Latin: '{chars}' → '{latin}'")


if __name__ == "__main__":
    test_simple_long_vowels()
    test_manually_created_double_chars()
