Add parsing (not executing) of deposit tests

This commit is contained in:
Paul Hauner
2019-05-22 15:34:12 +10:00
parent 07b94b30ba
commit 95b0df7087
6 changed files with 65 additions and 13 deletions

View File

@@ -1,13 +1,13 @@
use ef_tests::*;
use rayon::prelude::*;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use walkdir::WalkDir;
fn yaml_files_in_test_dir(dir: &str) -> Vec<PathBuf> {
let mut base_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
base_path.push("eth2.0-spec-tests");
base_path.push("tests");
base_path.push(dir);
fn yaml_files_in_test_dir(dir: &Path) -> Vec<PathBuf> {
let base_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("eth2.0-spec-tests")
.join("tests")
.join(dir);
assert!(
base_path.exists(),
@@ -34,7 +34,7 @@ fn yaml_files_in_test_dir(dir: &str) -> Vec<PathBuf> {
#[test]
#[cfg(feature = "fake_crypto")]
fn ssz_generic() {
yaml_files_in_test_dir("ssz_generic")
yaml_files_in_test_dir(&Path::new("ssz_generic"))
.into_par_iter()
.for_each(|file| {
Doc::assert_tests_pass(file);
@@ -44,17 +44,28 @@ fn ssz_generic() {
#[test]
#[cfg(feature = "fake_crypto")]
fn ssz_static() {
yaml_files_in_test_dir("ssz_static")
yaml_files_in_test_dir(&Path::new("ssz_static"))
.into_par_iter()
.for_each(|file| {
Doc::assert_tests_pass(file);
});
}
#[test]
#[cfg(feature = "fake_crypto")]
fn operations_deposit() {
yaml_files_in_test_dir(&Path::new("operations").join("deposit"))
// .into_par_iter()
.into_iter()
.for_each(|file| {
Doc::assert_tests_pass(file);
});
}
#[test]
#[cfg(not(feature = "fake_crypto"))]
fn bls() {
yaml_files_in_test_dir("bls")
yaml_files_in_test_dir(&Path::new("bls"))
.into_par_iter()
.for_each(|file| {
Doc::assert_tests_pass(file);