1
0
mirror of https://github.com/ellmau/adf-obdd.git synced 2025-12-18 09:19:38 +01:00
adf-obdd/tests/automated.rs
Stefan Ellmauthaler 0d5577e251
Implementing nom-based parser (#5)
* Implemented a nom-based parser to read the adf
* Grounded semantics (naive) re-implemented
* Docs added
* Updated Cargo.toml with more Manifest information
* Version update
* Added sort-methods to the parser, so the var-order can be adjusted
* Added sort functionality to the main function
* Added adf-instances as a submodule to the res-folder
* Added README information for the extended integration tests
* Rewritten main-function

Closes #3
2022-01-03 15:21:11 +01:00

27 lines
875 B
Rust

use adf_bdd::{adf::Adf, parser::AdfParser};
use test_generator::test_resources;
use test_log::test;
#[test_resources("res/adf-instances/instances/*.adf")]
fn compute_grounded(resource: &str) {
let grounded = &[
"res/adf-instances/grounded-interpretations/",
&resource[28..resource.len() - 8],
".apx.adf-grounded.txt",
]
.concat();
log::debug!("Grounded: {}", grounded);
let parser = AdfParser::default();
let expected_result = std::fs::read_to_string(grounded);
assert!(expected_result.is_ok());
let input = std::fs::read_to_string(resource).unwrap();
parser.parse()(&input).unwrap();
parser.varsort_alphanum();
let mut adf = Adf::from_parser(&parser);
let grounded = adf.grounded();
assert_eq!(
format!("{}", adf.print_interpretation(&grounded)),
expected_result.unwrap()
);
}