lighthouse/testing/state_transition_vectors/src/macros.rs
Michael Sproul b4689e20c6 Altair consensus changes and refactors (#2279)
## Proposed Changes

Implement the consensus changes necessary for the upcoming Altair hard fork.

## Additional Info

This is quite a heavy refactor, with pivotal types like the `BeaconState` and `BeaconBlock` changing from structs to enums. This ripples through the whole codebase with field accesses changing to methods, e.g. `state.slot` => `state.slot()`.


Co-authored-by: realbigsean <seananderson33@gmail.com>
2021-07-09 06:15:32 +00:00

29 lines
696 B
Rust

/// Provides:
///
/// - `fn vectors()`: allows for getting a `Vec<TestVector>` of all vectors for exporting.
/// - `mod tests`: runs all the test vectors locally.
macro_rules! vectors_and_tests {
($($name: ident, $test: expr),*) => {
pub fn vectors() -> Vec<TestVector> {
let mut vec = vec![];
$(
vec.push($test.test_vector(stringify!($name).into()));
)*
vec
}
#[cfg(all(test, not(debug_assertions)))]
mod tests {
use super::*;
$(
#[test]
fn $name() {
$test.run();
}
)*
}
};
}