Re-organise ef_tests

This commit is contained in:
Paul Hauner
2019-05-14 11:13:28 +10:00
parent c3b4739a11
commit b280c220eb
8 changed files with 167 additions and 76 deletions

View File

@@ -2,6 +2,7 @@ use ef_tests::*;
use serde::de::DeserializeOwned;
use std::{fs::File, io::prelude::*, path::PathBuf};
/*
fn load_test_case<T: DeserializeOwned>(test_name: &str) -> TestDoc<T> {
let mut file = {
let mut file_path_buf = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
@@ -23,10 +24,34 @@ fn ssz_generic() {
let results = doc.test();
let failures: Vec<&TestCaseResult<SszGeneric>> =
results.iter().filter(|r| r.result.is_err()).collect();
let failures: Vec<&TestCaseResult> = results.iter().filter(|r| r.result.is_err()).collect();
if !failures.is_empty() {
panic!("{:?}", failures);
}
}
*/
fn test_file(trailing_path: &str) -> PathBuf {
let mut file_path_buf = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
file_path_buf.push(format!("eth2.0-spec-tests/tests/{}", trailing_path));
file_path_buf
}
mod ssz_generic {
use super::*;
fn ssz_generic_file(file: &str) -> PathBuf {
let mut path = test_file("ssz_generic");
path.push(file);
dbg!(&path);
path
}
#[test]
fn uint_bounds() {
TestDoc::assert_tests_pass(ssz_generic_file("uint/uint_bounds.yaml"));
}
}