From 639533132547d8b303eb49c1b286a8f821d075f3 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Fri, 28 Dec 2018 10:13:37 -0500 Subject: [PATCH] check subset for insensitive loans --- src/test.rs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/test.rs b/src/test.rs index a9d58ce438f..83829cf474c 100644 --- a/src/test.rs +++ b/src/test.rs @@ -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.