mathic 0.2.0

A compiler with builtin support of symbolic operations, built with LLVM/MLIR
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
mod common;

use std::path::PathBuf;

use common::compile_and_execute;
use rstest::rstest;

#[rstest]
#[case("examples/arithmetic/addition.mth", 8)]
#[case("examples/arithmetic/subtraction.mth", 6)]
#[case("examples/arithmetic/multiplication.mth", 42)]
#[case("examples/arithmetic/division.mth", 5)]
#[case("examples/arithmetic/order_of_operations.mth", 14)]
fn test_arithmetic(#[case] path: PathBuf, #[case] expected: i64) {
    let result = compile_and_execute(&path);
    assert_eq!(result, expected);
}