tests: obsolete shorthand
This commit is contained in:
parent
6b33b5569d
commit
d17c021fc2
1 changed files with 4 additions and 9 deletions
|
|
@ -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,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue