Rename DocCases to Cases

This commit is contained in:
Paul Hauner 2019-05-15 11:17:32 +10:00
parent 2b8e8ce59e
commit 57040efc2a
No known key found for this signature in database
GPG Key ID: D362883A9218FCC6
5 changed files with 8 additions and 8 deletions

View File

@ -9,11 +9,11 @@ pub use ssz_generic::*;
pub use ssz_static::*; pub use ssz_static::*;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct DocCases<T> { pub struct Cases<T> {
pub test_cases: Vec<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 /// Decodes a YAML list of test cases
fn yaml_decode(yaml: &String) -> Result<Self, Error> { fn yaml_decode(yaml: &String) -> Result<Self, Error> {
let doc = &YamlLoader::load_from_str(yaml).unwrap()[0]; let doc = &YamlLoader::load_from_str(yaml).unwrap()[0];

View File

@ -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> { fn test<E: EthSpec>(&self) -> Vec<TestCaseResult> {
self.test_cases self.test_cases
.iter() .iter()

View File

@ -41,7 +41,7 @@ impl SszStatic {
} }
} }
impl Test for DocCases<SszStatic> { impl Test for Cases<SszStatic> {
fn test<E: EthSpec>(&self) -> Vec<TestCaseResult> { fn test<E: EthSpec>(&self) -> Vec<TestCaseResult> {
self.test_cases self.test_cases
.iter() .iter()

View File

@ -54,11 +54,11 @@ impl Doc {
pub fn run_test<T, E: EthSpec>(test_doc_yaml: &String) -> Vec<TestCaseResult> pub fn run_test<T, E: EthSpec>(test_doc_yaml: &String) -> Vec<TestCaseResult>
where 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_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>() test_cases.test::<E>()
} }

View File

@ -5,16 +5,16 @@ use ssz::Decode;
use std::fmt::Debug; use std::fmt::Debug;
pub use crate::case_result::*; pub use crate::case_result::*;
pub use crate::cases::*;
pub use crate::doc::*; pub use crate::doc::*;
pub use crate::doc_cases::*;
pub use crate::doc_header::*; pub use crate::doc_header::*;
pub use crate::error::*; pub use crate::error::*;
pub use crate::eth_specs::*; pub use crate::eth_specs::*;
pub use yaml_decode::YamlDecode; pub use yaml_decode::YamlDecode;
mod case_result; mod case_result;
mod cases;
mod doc; mod doc;
mod doc_cases;
mod doc_header; mod doc_header;
mod error; mod error;
mod eth_specs; mod eth_specs;