use depyler_core::transpile_python_to_rust;
#[test]
fn test_remainder() {
let python = r#"
import math
def get_remainder(x: float, y: float) -> float:
return math.remainder(x, y)
"#;
let result = transpile_python_to_rust(python).expect("Transpilation failed");
assert!(result.contains("round"));
}
#[test]
fn test_factorial() {
let python = r#"
import math
def get_factorial(n: int) -> int:
return math.factorial(n)
"#;
let result = transpile_python_to_rust(python).expect("Transpilation failed");
assert!(result.contains("for i in") || result.contains("result"));
}
#[test]
fn test_comb() {
let python = r#"
import math
def combinations(n: int, k: int) -> int:
return math.comb(n, k)
"#;
let result = transpile_python_to_rust(python).expect("Transpilation failed");
assert!(result.contains("result") && result.contains("for i in"));
}
#[test]
fn test_perm() {
let python = r#"
import math
def permutations(n: int, k: int) -> int:
return math.perm(n, k)
"#;
let result = transpile_python_to_rust(python).expect("Transpilation failed");
assert!(result.contains("result") && result.contains("for i in"));
}
#[test]
fn test_expm1() {
let python = r#"
import math
def exp_minus_one(x: float) -> float:
return math.expm1(x)
"#;
let result = transpile_python_to_rust(python).expect("Transpilation failed");
assert!(result.contains("exp_m1"));
}