Skip to content

Commit

Permalink
refactor(bdd): refactored bdd.evaluate to reduce coverage blindspots
Browse files Browse the repository at this point in the history
  • Loading branch information
AurumTheEnd committed May 15, 2024
1 parent d5513ff commit 95352db
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/bdd/traits/evaluate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@ impl<TLiteral: Debug + Clone + Eq + Ord> Evaluate<TLiteral> for Bdd<TLiteral> {
let v = self
.inputs
.iter()
.map(|input| {
if let Some(var_is_true) = literal_values.get(input) {
*var_is_true
} else {
default_value
}
})
.map(|input| *literal_values.get(input).unwrap_or(&default_value))
.collect_vec();

self.bdd.eval_in(&BddValuation::new(v))
Expand All @@ -34,13 +28,7 @@ impl<TLiteral: Debug + Clone + Eq + Ord> Evaluate<TLiteral> for Bdd<TLiteral> {
let (point, errors): (Vec<_>, Vec<_>) = self
.inputs
.iter()
.map(|input| {
if let Some(var_is_true) = literal_values.get(input) {
Ok(*var_is_true)
} else {
Err(input.clone())
}
})
.map(|input| literal_values.get(input).copied().ok_or(input.clone()))
.partition_result();

if !errors.is_empty() {
Expand Down

0 comments on commit 95352db

Please sign in to comment.