tests: for constants
This commit is contained in:
parent
d27a59df17
commit
33862c602d
1 changed files with 12 additions and 0 deletions
|
|
@ -4,6 +4,18 @@ use rug::Float;
|
||||||
|
|
||||||
use crate::nodes::{Function, Node, Nodes, Operator, PREC};
|
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]
|
#[test]
|
||||||
fn unary_operators() {
|
fn unary_operators() {
|
||||||
assert_eq!(Nodes::from_str("-10").unwrap().evaluate().to_f64(), -10.);
|
assert_eq!(Nodes::from_str("-10").unwrap().evaluate().to_f64(), -10.);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue