tests: obsolete shorthand

This commit is contained in:
electria 2026-07-15 21:57:47 -07:00
commit d17c021fc2
Signed by: electria
SSH key fingerprint: SHA256:8LlB3ucPbBHqozqkhsNbaV5oG3SlzzqUj8FZDL6IPQs

View file

@ -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,
);
}