expressive/tests/serde.rs

15 lines
402 B
Rust
Raw Normal View History

#![cfg(feature = "serde")]
2019-08-29 06:21:34 +00:00
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());
}
2019-08-29 07:02:05 +00:00
}