extern crate modelthing; extern crate modelica_parser; use std::path::Path; use modelthing::*; #[test] fn test_parse_metadata() { let raw = r#" [model] name-en = "Bogus Dummy Model" "#.to_string(); assert_eq!(parse_metadata(raw).unwrap(), ModelMetadata { name_en: "Bogus Dummy Model".to_string(), description_en: None, }); } #[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::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()))); }