aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2016-12-25 23:33:20 -0800
committerbnewbold <bnewbold@robocracy.org>2016-12-25 23:33:20 -0800
commit3e3f933595f64083e41433075e66aa275af66c6c (patch)
tree4ebf1f47d98c3371cfeb3a89e5b473edd5262af3 /tests
parent14d055dcc41044061357f206fe4ed71ce61fffce (diff)
downloadmodelthing-3e3f933595f64083e41433075e66aa275af66c6c.tar.gz
modelthing-3e3f933595f64083e41433075e66aa275af66c6c.zip
basic AST substituting (finishing first stab at solve_for)
Diffstat (limited to 'tests')
-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())));
+}