Pass case_index through Case trait

This commit is contained in:
Paul Hauner
2019-05-22 18:13:22 +10:00
parent b2666d700c
commit 14d879d75f
11 changed files with 20 additions and 14 deletions

View File

@@ -22,7 +22,11 @@ pub use ssz_generic::*;
pub use ssz_static::*;
pub trait Case {
fn result(&self) -> Result<(), Error>;
/// Execute a test and return the result.
///
/// `case_index` reports the index of the case in the set of test cases. It is not strictly
/// necessary, but it's useful when troubleshooting specific failing tests.
fn result(&self, case_index: usize) -> Result<(), Error>;
}
#[derive(Debug)]
@@ -38,7 +42,7 @@ where
self.test_cases
.iter()
.enumerate()
.map(|(i, tc)| CaseResult::new(i, tc, tc.result()))
.map(|(i, tc)| CaseResult::new(i, tc, tc.result(i)))
.collect()
}
}