depyler-core 3.24.0

Core transpilation engine for the Depyler Python-to-Rust transpiler
Documentation
// Generated by: DEPYLER stdlib validation Phase 1
// Module: bisect - Python bisect module validation
// Status: RED phase - Tests written first, implementation pending

use depyler_core::transpile_python_to_rust;

// DEPYLER-STDLIB-BISECT-001: Binary search
#[test]
fn test_bisect_left() {
    let python = r#"
import bisect

def find_insert_left(a: list, x: int) -> int:
    return bisect.bisect_left(a, x)
"#;

    let result = transpile_python_to_rust(python).expect("Transpilation failed");

    // Should find leftmost insertion point
    assert!(result.contains("bisect") || result.contains("binary_search"));
}

#[test]
fn test_bisect_right() {
    let python = r#"
import bisect

def find_insert_right(a: list, x: int) -> int:
    return bisect.bisect_right(a, x)
"#;

    let result = transpile_python_to_rust(python).expect("Transpilation failed");

    // Should find rightmost insertion point
    assert!(result.contains("bisect") || result.contains("binary_search"));
}

// DEPYLER-STDLIB-BISECT-002: Insertion
#[test]
fn test_insort_left() {
    let python = r#"
import bisect

def insert_left(a: list, x: int) -> None:
    bisect.insort_left(a, x)
"#;

    let result = transpile_python_to_rust(python).expect("Transpilation failed");

    // Should insert at leftmost position
    assert!(result.contains("insert") || result.contains("push"));
}

#[test]
fn test_insort_right() {
    let python = r#"
import bisect

def insert_right(a: list, x: int) -> None:
    bisect.insort_right(a, x)
"#;

    let result = transpile_python_to_rust(python).expect("Transpilation failed");

    // Should insert at rightmost position
    assert!(result.contains("insert") || result.contains("push"));
}

// Total: 4 comprehensive tests for bisect module
// Coverage: bisect_left, bisect_right, insort_left, insort_right
// Binary search and insertion for sorted sequences