diff --git a/src/nodes/tests.rs b/src/nodes/tests.rs index c6c8b91..9e3202b 100644 --- a/src/nodes/tests.rs +++ b/src/nodes/tests.rs @@ -1,18 +1,13 @@ use std::str::FromStr; -use rug::{Float, ops::CompleteRound}; +use rug::Float; use crate::nodes::{Function, Node, Nodes, Operator, PREC}; -/// shorthand for testing the final output of tylc -fn num(s: &str) -> Float { - Float::parse(s).unwrap().complete(PREC) -} - #[test] fn unary_operators() { - assert_eq!(Nodes::from_str("-10").unwrap().evaluate(), num("-10")); - assert_eq!(Nodes::from_str("+10").unwrap().evaluate(), num("+10")); + assert_eq!(Nodes::from_str("-10").unwrap().evaluate().to_f64(), -10.); + assert_eq!(Nodes::from_str("+10").unwrap().evaluate().to_f64(), 10.); } #[test] @@ -27,7 +22,7 @@ fn test_nodes_to_num() { Node::Number(Float::with_val(PREC, 1)) ]) .evaluate() - .to_f64_round(rug::float::Round::Nearest), + .to_f64(), 1.9092974268256817, ); }