Add progress on ssz_static tests
This commit is contained in:
parent
6096abf071
commit
1835ca8fd6
@ -1,6 +1,11 @@
|
||||
use super::*;
|
||||
use serde::de::{Deserialize, Deserializer};
|
||||
use types::Fork;
|
||||
use types::{
|
||||
Attestation, AttestationData, AttestationDataAndCustodyBit, AttesterSlashing, BeaconBlock,
|
||||
BeaconBlockBody, BeaconBlockHeader, BeaconState, Crosslink, Deposit, DepositData, Eth1Data,
|
||||
Fork, HistoricalBatch, PendingAttestation, ProposerSlashing, Transfer, Validator,
|
||||
VoluntaryExit,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct SszStatic {
|
||||
@ -44,6 +49,29 @@ impl Test for TestDocCases<SszStatic> {
|
||||
.map(|(i, tc)| {
|
||||
let result = match tc.type_name.as_ref() {
|
||||
"Fork" => ssz_static_test::<Fork>(tc),
|
||||
"Crosslink" => ssz_static_test::<Crosslink>(tc),
|
||||
"Eth1Data" => ssz_static_test::<Eth1Data>(tc),
|
||||
"AttestationData" => ssz_static_test::<AttestationData>(tc),
|
||||
/*
|
||||
"AttestationDataAndCustodyBit" => {
|
||||
ssz_static_test::<AttestationDataAndCustodyBit>(tc)
|
||||
}
|
||||
*/
|
||||
// "IndexedAttestation" => ssz_static_test::<IndexedAttestation>(tc),
|
||||
"DepositData" => ssz_static_test::<DepositData>(tc),
|
||||
"BeaconBlockHeader" => ssz_static_test::<BeaconBlockHeader>(tc),
|
||||
"Validator" => ssz_static_test::<Validator>(tc),
|
||||
"PendingAttestation" => ssz_static_test::<PendingAttestation>(tc),
|
||||
// "HistoricalBatch" => ssz_static_test::<HistoricalBatch>(tc),
|
||||
"ProposerSlashing" => ssz_static_test::<ProposerSlashing>(tc),
|
||||
"AttesterSlashing" => ssz_static_test::<AttesterSlashing>(tc),
|
||||
"Attestation" => ssz_static_test::<Attestation>(tc),
|
||||
"Deposit" => ssz_static_test::<Deposit>(tc),
|
||||
"VoluntaryExit" => ssz_static_test::<VoluntaryExit>(tc),
|
||||
"Transfer" => ssz_static_test::<Transfer>(tc),
|
||||
"BeaconBlockBody" => ssz_static_test::<BeaconBlockBody>(tc),
|
||||
"BeaconBlock" => ssz_static_test::<BeaconBlock>(tc),
|
||||
// "BeaconState" => ssz_static_test::<DepositData>(tc),
|
||||
_ => Err(Error::FailedToParseTest(format!(
|
||||
"Unknown type: {}",
|
||||
tc.type_name
|
||||
@ -58,7 +86,7 @@ impl Test for TestDocCases<SszStatic> {
|
||||
|
||||
fn ssz_static_test<T>(tc: &SszStatic) -> Result<(), Error>
|
||||
where
|
||||
T: Decode + TestDecode + Debug + PartialEq<T> + serde::de::DeserializeOwned,
|
||||
T: Decode + Debug + PartialEq<T> + serde::de::DeserializeOwned,
|
||||
{
|
||||
let ssz = hex::decode(&tc.serialized[2..])
|
||||
.map_err(|e| Error::FailedToParseTest(format!("{:?}", e)))?;
|
||||
|
@ -47,6 +47,7 @@ mod ssz_static {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn minimal_nil() {
|
||||
TestDoc::assert_tests_pass(ssz_generic_file("core/ssz_minimal_nil.yaml"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user