6ace829117
While this is a tiny hit on performance, it is something that the user probably wants. It specifically prevents the user from seeing ContextNotManipulable errors when using the full power of evalexpr in the simplest eval calls. Implements #45
14 lines
401 B
Rust
14 lines
401 B
Rust
#![cfg(feature = "serde")]
|
|
|
|
use evalexpr::{build_operator_tree, Node};
|
|
|
|
#[test]
|
|
fn test_serde() {
|
|
let strings = ["3", "4+4", "21^(2*2)--3>5||!true"];
|
|
|
|
for string in &strings {
|
|
let manual_tree = build_operator_tree(string).unwrap();
|
|
let serde_tree: Node = ron::de::from_str(&format!("\"{}\"", string)).unwrap();
|
|
assert_eq!(manual_tree.eval(), serde_tree.eval());
|
|
}
|
|
} |