aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib.rs
blob: 8899e0b21582f536b1c5fb23b1fe24ec00329101 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

extern crate modelthing;
extern crate modelica_parser;

use std::path::Path;

use modelthing::*;
use modelica_parser::*;


#[test]
fn test_load_model_entry() {
    load_model_entry(Path::new("./examples/classic_gravitation/")).unwrap();
}

#[test]
fn test_search_models() {
    assert_eq!(search_models(Path::new("./examples/")).len() > 1, true);
}

#[test]
fn test_substitute_with() {
    use modelica_parser::Expr::*;

    let y = BinExpr(BinOperator::Add,
                Box::new(Ident("y".to_string())),
                Box::new(Ident("y".to_string())));
    let z = BinExpr(BinOperator::Add,
                Box::new(Ident("z".to_string())),
                Box::new(Ident("z".to_string())));

    assert_eq!(z,
               modelica_model::substitute_with(&y,
                               &Ident("y".to_string()),
                               &Ident("z".to_string())));
}