Rename DocCases
to Cases
This commit is contained in:
parent
2b8e8ce59e
commit
57040efc2a
@ -9,11 +9,11 @@ pub use ssz_generic::*;
|
||||
pub use ssz_static::*;
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct DocCases<T> {
|
||||
pub struct Cases<T> {
|
||||
pub test_cases: Vec<T>,
|
||||
}
|
||||
|
||||
impl<T: YamlDecode> YamlDecode for DocCases<T> {
|
||||
impl<T: YamlDecode> YamlDecode for Cases<T> {
|
||||
/// Decodes a YAML list of test cases
|
||||
fn yaml_decode(yaml: &String) -> Result<Self, Error> {
|
||||
let doc = &YamlLoader::load_from_str(yaml).unwrap()[0];
|
@ -16,7 +16,7 @@ impl YamlDecode for SszGeneric {
|
||||
}
|
||||
}
|
||||
|
||||
impl Test for DocCases<SszGeneric> {
|
||||
impl Test for Cases<SszGeneric> {
|
||||
fn test<E: EthSpec>(&self) -> Vec<TestCaseResult> {
|
||||
self.test_cases
|
||||
.iter()
|
@ -41,7 +41,7 @@ impl SszStatic {
|
||||
}
|
||||
}
|
||||
|
||||
impl Test for DocCases<SszStatic> {
|
||||
impl Test for Cases<SszStatic> {
|
||||
fn test<E: EthSpec>(&self) -> Vec<TestCaseResult> {
|
||||
self.test_cases
|
||||
.iter()
|
@ -54,11 +54,11 @@ impl Doc {
|
||||
|
||||
pub fn run_test<T, E: EthSpec>(test_doc_yaml: &String) -> Vec<TestCaseResult>
|
||||
where
|
||||
DocCases<T>: Test + serde::de::DeserializeOwned + YamlDecode,
|
||||
Cases<T>: Test + serde::de::DeserializeOwned + YamlDecode,
|
||||
{
|
||||
let test_cases_yaml = extract_yaml_by_key(test_doc_yaml, "test_cases");
|
||||
|
||||
let test_cases: DocCases<T> = DocCases::yaml_decode(&test_cases_yaml.to_string()).unwrap();
|
||||
let test_cases: Cases<T> = Cases::yaml_decode(&test_cases_yaml.to_string()).unwrap();
|
||||
|
||||
test_cases.test::<E>()
|
||||
}
|
||||
|
@ -5,16 +5,16 @@ use ssz::Decode;
|
||||
use std::fmt::Debug;
|
||||
|
||||
pub use crate::case_result::*;
|
||||
pub use crate::cases::*;
|
||||
pub use crate::doc::*;
|
||||
pub use crate::doc_cases::*;
|
||||
pub use crate::doc_header::*;
|
||||
pub use crate::error::*;
|
||||
pub use crate::eth_specs::*;
|
||||
pub use yaml_decode::YamlDecode;
|
||||
|
||||
mod case_result;
|
||||
mod cases;
|
||||
mod doc;
|
||||
mod doc_cases;
|
||||
mod doc_header;
|
||||
mod error;
|
||||
mod eth_specs;
|
||||
|
Loading…
Reference in New Issue
Block a user