Skip to content

Commit

Permalink
check subset for insensitive loans
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed Dec 28, 2018
1 parent e46a99a commit 6395331
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,29 @@ fn test_facts(all_facts: &AllFacts, algorithms: &[Algorithm]) {
// If the insensitive analysis concludes no errors, then naive
// should also.
let insensitive = Output::compute(all_facts, Algorithm::LocationInsensitive, false);
if insensitive.errors.is_empty() {
assert_equal(&naive.errors, &insensitive.errors);
for (naive_point, naive_loans) in &naive.errors {
match insensitive.errors.get(&naive_point) {
Some(insensitive_loans) => {
for naive_loan in naive_loans {
if !insensitive_loans.contains(naive_loan) {
panic!(
"naive analysis had error for `{:?}` at `{:?}` \
but insensitive analysis did not \
(loans = {:#?})",
naive_point, naive_loan, insensitive_loans,
);
}
}
}

None => {
panic!(
"naive analysis had errors at `{:?}` but insensitive analysis did not \
(loans = {:#?})",
naive_point, naive_loans,
);
}
}
}

// The optimized checks should behave exactly the same as the naive check.
Expand Down

0 comments on commit 6395331

Please sign in to comment.