diff options
| author | bnewbold <bnewbold@robocracy.org> | 2016-12-26 01:13:35 -0800 | 
|---|---|---|
| committer | bnewbold <bnewbold@robocracy.org> | 2016-12-26 01:14:32 -0800 | 
| commit | c12c61cb0f34df3421b9e967e74c0603f9e44a0f (patch) | |
| tree | dcff0b8665040aaa53c5897c7e74e940ded5d6c6 | |
| parent | 7168804b8a555f1ecfb11d595c63384fda7a8f6f (diff) | |
| download | modelthing-c12c61cb0f34df3421b9e967e74c0603f9e44a0f.tar.gz modelthing-c12c61cb0f34df3421b9e967e74c0603f9e44a0f.zip | |
fix tests
| -rw-r--r-- | TODO | 3 | ||||
| -rw-r--r-- | src/modelica_model.rs | 2 | ||||
| -rw-r--r-- | tests/lib.rs | 9 | 
3 files changed, 8 insertions, 6 deletions
| @@ -1,12 +1,13 @@  cleanups and fixes:  - refactor away metadata into just modelica and examples.toml -- refactor to use HashSet instead of Vec<String>  - 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())));  } | 
