SSZ generic tests for big uints

This commit is contained in:
Michael Sproul
2019-09-04 13:03:44 +10:00
parent f47eaf5730
commit d511c939eb
23 changed files with 185 additions and 165 deletions

View File

@@ -9,6 +9,7 @@ mod bls_g2_compressed;
mod bls_g2_uncompressed;
mod bls_priv_to_pub;
mod bls_sign_msg;
mod common;
mod epoch_processing;
mod genesis_initialization;
mod genesis_validity;
@@ -25,6 +26,7 @@ pub use bls_g2_compressed::*;
pub use bls_g2_uncompressed::*;
pub use bls_priv_to_pub::*;
pub use bls_sign_msg::*;
pub use common::SszStaticType;
pub use epoch_processing::*;
pub use genesis_initialization::*;
pub use genesis_validity::*;
@@ -61,20 +63,6 @@ pub trait Case: Debug + Sync {
fn result(&self, case_index: usize) -> Result<(), Error>;
}
pub trait BlsCase: serde::de::DeserializeOwned {}
impl<T: BlsCase> YamlDecode for T {
fn yaml_decode(string: &str) -> Result<Self, Error> {
serde_yaml::from_str(string).map_err(|e| Error::FailedToParseTest(format!("{:?}", e)))
}
}
impl<T: BlsCase> LoadCase for T {
fn load_from_dir(path: &Path) -> Result<Self, Error> {
Self::yaml_decode_file(&path.join("data.yaml"))
}
}
#[derive(Debug)]
pub struct Cases<T> {
pub test_cases: Vec<T>,