aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib.rs')
-rw-r--r--tests/lib.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/lib.rs b/tests/lib.rs
index bf28476..77359de 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -32,3 +32,20 @@ fn test_load_model_entry() {
fn test_search_models() {
assert_eq!(search_models(Path::new("./examples/")).len() > 1, true);
}
+
+#[test]
+fn test substitute_with() {
+ use modelica_parser::ast::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,
+ substitute_with(&y,
+ Ident("y".to_string()),
+ Ident("z".to_string())));
+}