extern crate rcalc; #[cfg(test)] mod precedence { use rcalc::Interpreter; #[test] fn mdas() { assert_eq!(Interpreter::process("7 + 3 * 2 - 4 / 2").unwrap(), 11.); } #[test] fn emdas() { assert_eq!(Interpreter::process("6 ^ 2 / 6").unwrap(), 6.) } #[test] fn femdas() { assert_eq!(Interpreter::process("6 ^ 9 / 3! ^ 3").unwrap(), 46656.) } #[test] fn pfemdas() { assert_eq!( Interpreter::process("7 + 3 * (10 / (12 / (3 + 1) - 1)) / (2 + 3) - 5 - 3 + (8)") .unwrap(), 10. ); } }