40 lines
No EOL
839 B
Rust
40 lines
No EOL
839 B
Rust
|
|
|
|
|
|
#![allow(unused_imports)]
|
|
#![allow(unused_variables)]
|
|
#![allow(dead_code)]
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn test_parse_calculate_result_integer() {
|
|
let result = parse_calculate_result("42").unwrap();
|
|
assert_eq!(result.as_int().unwrap(), 42);
|
|
}
|
|
|
|
#[test]
|
|
|
|
|
|
fn test_parse_calculate_result_float() {
|
|
let result = parse_calculate_result("3.14").unwrap();
|
|
assert!((result.as_float().unwrap() - 3.14).abs() < 0.001);
|
|
}
|
|
|
|
#[test]
|
|
|
|
|
|
fn test_parse_calculate_result_boolean() {
|
|
let result = parse_calculate_result("true").unwrap();
|
|
assert!(result.as_bool().unwrap());
|
|
}
|
|
|
|
#[test]
|
|
|
|
|
|
fn test_build_translate_prompt() {
|
|
let prompt = build_translate_prompt("Hello", "Spanish");
|
|
assert!(prompt.contains("Hello"));
|
|
assert!(prompt.contains("Spanish"));
|
|
} |