xprs 0.1.0

Xprs is a flexible and extensible mathematical expression parser and evaluator for Rust, designed for simplicity and ease of use.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* Crate imports */
use crate::Parser;

#[test]
fn parse_number() {
    const INPUT: &str = "x^4";
    let parser = Parser::default();
    let result = parser.parse(INPUT);
    assert!(result.is_ok(), "Should have parsed: '{INPUT}'.");
    let xprs = result.unwrap();
    let expected_vars = ["x"].into();
    assert_eq!(
        xprs.vars, expected_vars,
        "{INPUT}\nExpected: {expected_vars:?}, got: {:?}",
        xprs.vars
    );
}