Skip to content

Commit

Permalink
slightly more succinct
Browse files Browse the repository at this point in the history
  • Loading branch information
zancas authored and idky137 committed Feb 28, 2024
1 parent 6cdeaad commit 5984b87
Showing 1 changed file with 26 additions and 27 deletions.
53 changes: 26 additions & 27 deletions zebra-chain/src/test_utils/vectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,35 +243,34 @@ mod vector_tests {
}
}
}


#[test]
fn get_block_sapling_roots_bytes(network in networks()) {
let mainnet = Network::Mainnet;
let testnet = Network::Testnet;
let result = mainnet.get_block_sapling_roots_bytes(0, 1116000);
matches!(
result,
Err(SerializationError::NotACachedMainNetSaplingRootBytes(0))
);
let result = mainnet.get_block_sapling_roots_bytes(1046400, 0).unwrap();
let _correct_main_result: (&[u8], [u8; 32]) = (
&BLOCK_MAINNET_1046400_BYTES[..],
*SAPLING_FINAL_ROOT_MAINNET_1046400_BYTES,
);
matches!(result, _correct_main_result);

let result = testnet.get_block_sapling_roots_bytes(1046400, 0);
matches!(
result,
Err(SerializationError::NotACachedTestNetSaplingRootBytes(0))
);
let result = testnet.get_block_sapling_roots_bytes(0, 1116000).unwrap();
let _correct_test_result: (&[u8], [u8; 32]) = (
&BLOCK_TESTNET_1116000_BYTES[..],
*SAPLING_FINAL_ROOT_TESTNET_1116000_BYTES,
);
matches!(result, _correct_test_result);
match network {
Network::Mainnet => {
matches!(
network.get_block_sapling_roots_bytes(0, 1116000),
Err(SerializationError::NotACachedMainNetSaplingRootBytes(0))
);
let result = network.get_block_sapling_roots_bytes(1046400, 0).unwrap();
let _correct_main_result: (&[u8], [u8; 32]) = (
&BLOCK_MAINNET_1046400_BYTES[..],
*SAPLING_FINAL_ROOT_MAINNET_1046400_BYTES,
);
matches!(result, _correct_main_result);
},
Network::Testnet => {
matches!(
network.get_block_sapling_roots_bytes(1046400, 0),
Err(SerializationError::NotACachedTestNetSaplingRootBytes(0))
);
let result = network.get_block_sapling_roots_bytes(0, 1116000).unwrap();
let _correct_test_result: (&[u8], [u8; 32]) = (
&BLOCK_TESTNET_1116000_BYTES[..],
*SAPLING_FINAL_ROOT_TESTNET_1116000_BYTES,
);
matches!(result, _correct_test_result);
}
}
}
}

Expand Down

0 comments on commit 5984b87

Please sign in to comment.