From c12c61cb0f34df3421b9e967e74c0603f9e44a0f Mon Sep 17 00:00:00 2001 From: bnewbold Date: Mon, 26 Dec 2016 01:13:35 -0800 Subject: fix tests --- TODO | 3 ++- src/modelica_model.rs | 2 +- tests/lib.rs | 9 +++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index e78fea0..b102500 100644 --- a/TODO +++ b/TODO @@ -1,12 +1,13 @@ cleanups and fixes: - refactor away metadata into just modelica and examples.toml -- refactor to use HashSet instead of Vec - proper error handling types/story - validate incomplete identifiers (?) - finish rebalance/resolve/rephrase for {x} + => tests! +- switch to .mo files - latex output - tangle demo - http://blog.littleredcomputer.net/math/odex/js/2016/04/03/lotka-volterra.html diff --git a/src/modelica_model.rs b/src/modelica_model.rs index 1231546..785b8ae 100644 --- a/src/modelica_model.rs +++ b/src/modelica_model.rs @@ -170,7 +170,7 @@ impl ModelicaModelExt for ModelicaModel { } // Recurses through 'original', replacing all instances of 'a' with 'b' -fn substitute_with(original: &Expr, a: &Expr, b: &Expr) -> Expr { +pub fn substitute_with(original: &Expr, a: &Expr, b: &Expr) -> Expr { use modelica_parser::Expr::*; println!("original: {:?} replacing: {:?} with: {:?}", original, a, b); if *original == *a { diff --git a/tests/lib.rs b/tests/lib.rs index fb9c98d..de19f5b 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -5,6 +5,7 @@ extern crate modelica_parser; use std::path::Path; use modelthing::*; +use modelica_parser::*; #[test] @@ -32,7 +33,7 @@ fn test_search_models() { } #[test] -fn test substitute_with() { +fn test_substitute_with() { use modelica_parser::Expr::*; let y = BinExpr(BinOperator::Add, @@ -43,7 +44,7 @@ fn test substitute_with() { Box::new(Ident("z".to_string()))); assert_eq!(z, - substitute_with(&y, - Ident("y".to_string()), - Ident("z".to_string()))); + modelica_model::substitute_with(&y, + &Ident("y".to_string()), + &Ident("z".to_string()))); } -- cgit v1.2.3