Add slow LMD Ghost working tests.

This commit is contained in:
Age Manning
2019-02-19 15:08:55 +11:00
parent 846cbdd7f7
commit bd66a02cb3
4 changed files with 64 additions and 12 deletions

View File

@@ -0,0 +1,21 @@
title: Fork-choice Tests
summary: A collection of abstract fork-choice tests for lmd ghost.
test_suite: Fork-Choice
test_cases:
- blocks:
- id: 'b0'
parent: 'b0'
- id: 'b1'
parent: 'b0'
- id: 'b2'
parent: 'b1'
- id: 'b3'
parent: 'b1'
weights:
- b0: 0
- b1: 0
- b2: 5
- b3: 10
heads:
- id: 'b3'

View File

@@ -1,5 +1,5 @@
title: Fork-choice Tests
summary: A collection of abstract fork-choice tests.
summary: A collection of abstract fork-choice tests for bitwise lmd ghost.
test_suite: Fork-Choice
test_cases:

View File

@@ -25,13 +25,23 @@ use types::{
};
use yaml_rust::yaml;
// run tests
#[test]
fn test_optimised_lmd_ghost() {
test_yaml_vectors(
ForkChoiceAlgorithm::OptimisedLMDGhost,
"tests/optimised_lmd_ghost_test_vectors.yaml",
100,
"debug",
);
}
#[test]
fn test_slow_lmd_ghost() {
test_yaml_vectors(
ForkChoiceAlgorithm::SlowLMDGhost,
"tests/lmd_ghost_test_vectors.yaml",
100,
"debug",
);
}
@@ -40,9 +50,10 @@ fn test_yaml_vectors(
fork_choice_algo: ForkChoiceAlgorithm,
yaml_file_path: &str,
max_validators: usize,
log_level: &str,
) {
// set up logging
Builder::from_env(Env::default().default_filter_or("debug")).init();
Builder::from_env(Env::default().default_filter_or(log_level)).init();
// load test cases from yaml
let test_cases = load_test_cases_from_yaml(yaml_file_path);