Skip to content

Commit

Permalink
feat(expression): added 5x5 distribution n_ary test
Browse files Browse the repository at this point in the history
  • Loading branch information
AurumTheEnd committed Oct 4, 2023
1 parent d95010f commit a130073
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions src/expressions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,69 @@ mod tests {
assert!(expected.semantic_eq(&actual));
assert!(actual.is_cnf());
}

#[test]
fn to_cnf_n_ary_2() {
let input = Expression::n_ary_or(vec![
Literal("e1"),
Literal("e2"),
Literal("e3"),
Literal("e4"),
Literal("e5"),
Expression::n_ary_and(vec![
Literal("c1"),
Literal("c2"),
Literal("c3"),
Literal("c4"),
Literal("c5"),
]),
]);

let expected = Expression::n_ary_and(vec![
Expression::n_ary_or(vec![
Literal("e1"),
Literal("e2"),
Literal("e3"),
Literal("e4"),
Literal("e5"),
Literal("c1"),
]),
Expression::n_ary_or(vec![
Literal("e1"),
Literal("e2"),
Literal("e3"),
Literal("e4"),
Literal("e5"),
Literal("c2"),
]),
Expression::n_ary_or(vec![
Literal("e1"),
Literal("e2"),
Literal("e3"),
Literal("e4"),
Literal("e5"),
Literal("c3"),
]),
Expression::n_ary_or(vec![
Literal("e1"),
Literal("e2"),
Literal("e3"),
Literal("e4"),
Literal("e5"),
Literal("c4"),
]),
Expression::n_ary_or(vec![
Literal("e1"),
Literal("e2"),
Literal("e3"),
Literal("e4"),
Literal("e5"),
Literal("c5"),
]),
]);
let actual = input.to_cnf();

assert!(expected.semantic_eq(&actual));
assert!(actual.is_cnf());
}
}

0 comments on commit a130073

Please sign in to comment.