aboutsummaryrefslogtreecommitdiffstats
path: root/modelica-parser-lalrpop/tests/examples.rs.WIP
diff options
context:
space:
mode:
Diffstat (limited to 'modelica-parser-lalrpop/tests/examples.rs.WIP')
-rw-r--r--modelica-parser-lalrpop/tests/examples.rs.WIP29
1 files changed, 29 insertions, 0 deletions
diff --git a/modelica-parser-lalrpop/tests/examples.rs.WIP b/modelica-parser-lalrpop/tests/examples.rs.WIP
new file mode 100644
index 0000000..a206ac6
--- /dev/null
+++ b/modelica-parser-lalrpop/tests/examples.rs.WIP
@@ -0,0 +1,29 @@
+
+extern crate modelica_parser;
+
+use std::io::Read;
+use std::fs::{File, read_dir};
+use std::path::Path;
+use modelica_parser::parser::parse_model;
+
+fn do_file(p: &Path) {
+ let mut s = String::new();
+ File::open(p).and_then(|mut f| f.read_to_string(&mut s)).unwrap();
+ modelica_parser::parser::parse_model(&s).unwrap();
+}
+
+#[test]
+fn test_example_files() {
+
+ let files: Vec<&Path> = read_dir(Path::new("./examples/modelica_models/"))
+ .unwrap()
+ .map(|x| x.unwrap())
+ .filter(|x| x.metadata().unwrap().is_file())
+ .filter(|x| x.path().suffix().equals(".mo"))
+ .map(|x| x.path())
+ .collect();
+
+ for p in &files {
+ do_file(p);
+ }
+}