Skip to content

Commit

Permalink
fix(tests): added Table is_equivalent test by using trait in semantic_eq
Browse files Browse the repository at this point in the history
  • Loading branch information
AurumTheEnd committed May 8, 2024
1 parent 4662f84 commit 94de92f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/table/traits/semantic_eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,22 @@ impl<TLiteral: Debug + Clone + Eq + Ord> SemanticEq<TLiteral> for TruthTable<TLi
#[cfg(test)]
mod tests {
use super::*;
use crate::traits::BooleanFunction;

#[test]
fn test_semantic_eq_same_variables_ok_equal() {
let input_1 = TruthTable::new(vec!["a", "b"], vec![true, false, true, false]);
let input_2 = TruthTable::new(vec!["a", "b"], vec![true, false, true, false]);

assert!(input_1.semantic_eq(&input_2));
assert!(input_1.is_equivalent(&input_2));
}

#[test]
fn test_semantic_eq_same_variables_ok_not_equal() {
let input_1 = TruthTable::new(vec!["a", "b"], vec![true, false, true, false]);
let input_2 = TruthTable::new(vec!["a", "b"], vec![true, true, true, false]);

assert!(!input_1.semantic_eq(&input_2));
assert!(!input_1.is_equivalent(&input_2));
}

#[test]
Expand All @@ -48,14 +49,14 @@ mod tests {
vec![true, true, false, false, true, true, false, false],
);

assert!(input_1.semantic_eq(&input_2));
assert!(input_1.is_equivalent(&input_2));
}

#[test]
fn test_semantic_eq_different_variables_ok_not_equal() {
let input_1 = TruthTable::new(vec!["a", "b"], vec![true, false, true, false]);
let input_2 = TruthTable::new(vec!["a", "c"], vec![true, false, true, false]);

assert!(!input_1.semantic_eq(&input_2));
assert!(!input_1.is_equivalent(&input_2));
}
}

0 comments on commit 94de92f

Please sign in to comment.