mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2025-01-12 14:00:06 +00:00
Update ef_tests
for new compare_fields
API
This commit is contained in:
parent
99ae734638
commit
686963bd34
@ -86,7 +86,9 @@ where
|
||||
pub fork: Fork,
|
||||
|
||||
// Validator registry
|
||||
#[compare_fields(as_slice)]
|
||||
pub validator_registry: Vec<Validator>,
|
||||
#[compare_fields(as_slice)]
|
||||
pub balances: Vec<u64>,
|
||||
|
||||
// Randomness and committees
|
||||
|
@ -1,5 +1,5 @@
|
||||
use super::*;
|
||||
use compare_fields::{CompareFields, FieldComparison};
|
||||
use compare_fields::{CompareFields, Comparison, FieldComparison};
|
||||
use std::fmt::Debug;
|
||||
use types::BeaconState;
|
||||
|
||||
@ -51,13 +51,17 @@ where
|
||||
{
|
||||
match (result, expected) {
|
||||
(Ok(result), Some(expected)) => {
|
||||
let mismatching_fields: Vec<FieldComparison> = expected
|
||||
let mut mismatching_fields: Vec<Comparison> = expected
|
||||
.compare_fields(result)
|
||||
.into_iter()
|
||||
.filter(|c| !c.equal)
|
||||
// .map(|c| c.field_name)
|
||||
// Filter all out all fields that are equal.
|
||||
.filter(Comparison::not_equal)
|
||||
.collect();
|
||||
|
||||
mismatching_fields
|
||||
.iter_mut()
|
||||
.for_each(|f| f.retain_children(FieldComparison::not_equal));
|
||||
|
||||
if !mismatching_fields.is_empty() {
|
||||
Err(Error::NotEqual(format!(
|
||||
"Fields not equal (a = expected, b = result): {:#?}",
|
||||
|
Loading…
Reference in New Issue
Block a user