use depyler_core::transpile_python_to_rust;
#[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");
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");
assert!(result.contains("bisect") || result.contains("binary_search"));
}
#[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");
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");
assert!(result.contains("insert") || result.contains("push"));
}