tests: for constants

This commit is contained in:
electria 2026-07-15 23:47:35 -07:00
commit 33862c602d
Signed by: electria
SSH key fingerprint: SHA256:8LlB3ucPbBHqozqkhsNbaV5oG3SlzzqUj8FZDL6IPQs

View file

@ -4,6 +4,18 @@ use rug::Float;
use crate::nodes::{Function, Node, Nodes, Operator, PREC};
#[test]
fn constants() {
assert_eq!(
Nodes::from_str("c").unwrap().evaluate().to_f64(),
299792458.
);
assert_eq!(
Nodes::from_str("A").unwrap().evaluate().to_f64(),
6.02214076e23
);
}
#[test]
fn unary_operators() {
assert_eq!(Nodes::from_str("-10").unwrap().evaluate().to_f64(), -10.);