Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
yancyribbens committed Oct 6, 2024
1 parent 6c0e553 commit 00101bf
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/branch_and_bound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ mod tests {
}

Ok(())
}).seed(0x13de95f300000373);
});
}

#[test]
Expand Down Expand Up @@ -884,10 +884,10 @@ mod tests {

let mut gen = exhaustigen::Gen::new();

let mut solutions: Vec<_> = Vec::new();
let mut solutions: Vec<Vec<&Utxo>> = Vec::new();
while !gen.done() {
let subset = gen.gen_subset(&pool.utxos).collect::<Vec<_>>();
let subset_sum: SignedAmount = subset
let subset_sum = subset
.iter()
.map(|u| {
effective_value(
Expand All @@ -897,13 +897,13 @@ mod tests {
)})
.filter(|e| e.is_some())
.map(|u| u.unwrap())
.sum();

if subset_sum.is_positive() {
let sum: Amount = subset_sum.to_unsigned().unwrap();
.checked_sum();

if sum >= target && sum <= target + cost_of_change {
solutions.push(subset);
if let Some(s) = subset_sum {
if let Ok(sum) = s.to_unsigned() {
if sum >= target && sum <= target + cost_of_change {
solutions.push(subset);
}
}
}
}
Expand All @@ -916,8 +916,8 @@ mod tests {
&pool.utxos,
);

if solutions.is_empty() {
assert!(result.is_none() || result.unwrap().collect::<Vec<_>>().is_empty());
if solutions.is_empty() || target == Amount::ZERO {
assert!(result.is_none());
} else {
let iter = result.unwrap();

Expand Down

0 comments on commit 00101bf

Please sign in to comment.