Rename TEST_BLOCKS to BLOCKS

To avoid confusion with TESTNET_BLOCKS.

Automated search and replace, made using this script:

sed -i 's/TEST_BLOCKS/BLOCKS/' \
  $(grep -r TEST_BLOCKS zebra* | cut -d: -f1 | sort -u)
This commit is contained in:
teor 2020-09-29 17:10:41 +10:00 committed by Deirdre Connolly
parent a35f36dd0b
commit 58041d8a49
3 changed files with 10 additions and 10 deletions

View File

@ -63,7 +63,7 @@ fn deserialize_block() {
.zcash_deserialize_into::<Block>()
.expect("block test vector should deserialize");
for block in zebra_test::vectors::TEST_BLOCKS.iter() {
for block in zebra_test::vectors::BLOCKS.iter() {
block
.zcash_deserialize_into::<Block>()
.expect("block is structurally valid");
@ -72,8 +72,8 @@ fn deserialize_block() {
#[test]
fn block_test_vectors_unique() {
let block_count = zebra_test::vectors::TEST_BLOCKS.len();
let block_hashes: HashSet<_> = zebra_test::vectors::TEST_BLOCKS
let block_count = zebra_test::vectors::BLOCKS.len();
let block_hashes: HashSet<_> = zebra_test::vectors::BLOCKS
.iter()
.map(|b| {
b.zcash_deserialize_into::<Block>()

View File

@ -36,7 +36,7 @@ prop_compose! {
fn equihash_prop_test_solution() -> color_eyre::eyre::Result<()> {
zebra_test::init();
for block_bytes in zebra_test::vectors::TEST_BLOCKS.iter() {
for block_bytes in zebra_test::vectors::BLOCKS.iter() {
let block = Block::zcash_deserialize(&block_bytes[..])
.expect("block test vector should deserialize");
block.header.solution.check(&block.header)?;
@ -68,7 +68,7 @@ prop_compose! {
fn equihash_prop_test_nonce() -> color_eyre::eyre::Result<()> {
zebra_test::init();
for block_bytes in zebra_test::vectors::TEST_BLOCKS.iter() {
for block_bytes in zebra_test::vectors::BLOCKS.iter() {
let block = Block::zcash_deserialize(&block_bytes[..])
.expect("block test vector should deserialize");
block.header.solution.check(&block.header)?;
@ -103,7 +103,7 @@ prop_compose! {
fn equihash_prop_test_input() -> color_eyre::eyre::Result<()> {
zebra_test::init();
for block_bytes in zebra_test::vectors::TEST_BLOCKS.iter() {
for block_bytes in zebra_test::vectors::BLOCKS.iter() {
let block = Block::zcash_deserialize(&block_bytes[..])
.expect("block test vector should deserialize");
block.header.solution.check(&block.header)?;

View File

@ -9,7 +9,7 @@ use std::iter::FromIterator;
lazy_static! {
/// All block test vectors
pub static ref TEST_BLOCKS: Vec<&'static [u8]> = MAINNET_BLOCKS.iter().chain(TESTNET_BLOCKS.iter()).map(|(_height, block)| *block).collect();
pub static ref BLOCKS: Vec<&'static [u8]> = MAINNET_BLOCKS.iter().chain(TESTNET_BLOCKS.iter()).map(|(_height, block)| *block).collect();
// Update these lists of blocks when you add new block test vectors to
// this file
@ -323,8 +323,8 @@ mod test {
#[test]
fn block_test_vectors_unique() {
let block_count = TEST_BLOCKS.len();
let block_set: HashSet<_> = TEST_BLOCKS.iter().collect();
let block_count = BLOCKS.len();
let block_set: HashSet<_> = BLOCKS.iter().collect();
// putting the same block in two files is an easy mistake to make
assert_eq!(
@ -340,7 +340,7 @@ mod test {
#[test]
fn block_test_vectors_count() {
assert!(
TEST_BLOCKS.len() > 50,
BLOCKS.len() > 50,
"there should be a reasonable number of block test vectors"
);
}