Experimental method for testing all permutations

This commit is contained in:
Patrick Lühne 2020-04-08 08:41:03 +02:00
parent 21d4b1d605
commit f3b4cdc399
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
1 changed files with 10 additions and 0 deletions

View File

@ -364,6 +364,16 @@ mod tests
use crate::*;
use crate::format::terms::tests::*;
fn assert_all<F>(input: F, output: &str)
where
F: Fn(Box<Fn(Box<Formula>) -> Box<Formula>>) -> Box<Formula>,
{
assert_eq!(format(input(Box::new(|f| f))), output);
assert_eq!(format(input(Box::new(|f| and(vec![f])))), output);
assert_eq!(format(input(Box::new(|f| or(vec![f])))), output);
assert_eq!(format(input(Box::new(|f| if_and_only_if(vec![f])))), output);
}
fn format(formula: Box<ast::Formula>) -> String
{
format!("{}", formula)