Call `zebra_test::init` where needed. (#1227)
* Add missing `zebra_test::init()` to zebra-chain * Add missing `zebra_test::init()` to zebra-consensus * Add missing `zebra_test::init()` to zebra-network * Add missing `zebra_test::init()` to zebra-state * Add missing `zebra_test::init()` to zebra-test * Add missing `zebra_test::init()` to zebrad
This commit is contained in:
parent
34f50d7ebb
commit
128643d81e
|
@ -403,6 +403,7 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_add_bare() -> Result<()> {
|
fn test_add_bare() -> Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
let one: Amount = 1.try_into()?;
|
let one: Amount = 1.try_into()?;
|
||||||
let neg_one: Amount = (-1).try_into()?;
|
let neg_one: Amount = (-1).try_into()?;
|
||||||
|
|
||||||
|
@ -417,6 +418,7 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_add_opt_lhs() -> Result<()> {
|
fn test_add_opt_lhs() -> Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
let one: Amount = 1.try_into()?;
|
let one: Amount = 1.try_into()?;
|
||||||
let one = Ok(one);
|
let one = Ok(one);
|
||||||
let neg_one: Amount = (-1).try_into()?;
|
let neg_one: Amount = (-1).try_into()?;
|
||||||
|
@ -432,6 +434,7 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_add_opt_rhs() -> Result<()> {
|
fn test_add_opt_rhs() -> Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
let one: Amount = 1.try_into()?;
|
let one: Amount = 1.try_into()?;
|
||||||
let neg_one: Amount = (-1).try_into()?;
|
let neg_one: Amount = (-1).try_into()?;
|
||||||
let neg_one = Ok(neg_one);
|
let neg_one = Ok(neg_one);
|
||||||
|
@ -447,6 +450,7 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_add_opt_both() -> Result<()> {
|
fn test_add_opt_both() -> Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
let one: Amount = 1.try_into()?;
|
let one: Amount = 1.try_into()?;
|
||||||
let one = Ok(one);
|
let one = Ok(one);
|
||||||
let neg_one: Amount = (-1).try_into()?;
|
let neg_one: Amount = (-1).try_into()?;
|
||||||
|
@ -463,6 +467,7 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_add_assign() -> Result<()> {
|
fn test_add_assign() -> Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
let one: Amount = 1.try_into()?;
|
let one: Amount = 1.try_into()?;
|
||||||
let neg_one: Amount = (-1).try_into()?;
|
let neg_one: Amount = (-1).try_into()?;
|
||||||
let mut neg_one = Ok(neg_one);
|
let mut neg_one = Ok(neg_one);
|
||||||
|
@ -479,6 +484,7 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_sub_bare() -> Result<()> {
|
fn test_sub_bare() -> Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
let one: Amount = 1.try_into()?;
|
let one: Amount = 1.try_into()?;
|
||||||
let zero: Amount = 0.try_into()?;
|
let zero: Amount = 0.try_into()?;
|
||||||
|
|
||||||
|
@ -493,6 +499,7 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_sub_opt_lhs() -> Result<()> {
|
fn test_sub_opt_lhs() -> Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
let one: Amount = 1.try_into()?;
|
let one: Amount = 1.try_into()?;
|
||||||
let one = Ok(one);
|
let one = Ok(one);
|
||||||
let zero: Amount = 0.try_into()?;
|
let zero: Amount = 0.try_into()?;
|
||||||
|
@ -508,6 +515,7 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_sub_opt_rhs() -> Result<()> {
|
fn test_sub_opt_rhs() -> Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
let one: Amount = 1.try_into()?;
|
let one: Amount = 1.try_into()?;
|
||||||
let zero: Amount = 0.try_into()?;
|
let zero: Amount = 0.try_into()?;
|
||||||
let zero = Ok(zero);
|
let zero = Ok(zero);
|
||||||
|
@ -523,6 +531,7 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_sub_assign() -> Result<()> {
|
fn test_sub_assign() -> Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
let one: Amount = 1.try_into()?;
|
let one: Amount = 1.try_into()?;
|
||||||
let zero: Amount = 0.try_into()?;
|
let zero: Amount = 0.try_into()?;
|
||||||
let mut zero = Ok(zero);
|
let mut zero = Ok(zero);
|
||||||
|
@ -538,6 +547,8 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn add_with_diff_constraints() -> Result<()> {
|
fn add_with_diff_constraints() -> Result<()> {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let one = Amount::<NonNegative>::try_from(1)?;
|
let one = Amount::<NonNegative>::try_from(1)?;
|
||||||
let zero = Amount::<NegativeAllowed>::try_from(0)?;
|
let zero = Amount::<NegativeAllowed>::try_from(0)?;
|
||||||
|
|
||||||
|
@ -549,6 +560,8 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn deserialize_checks_bounds() -> Result<()> {
|
fn deserialize_checks_bounds() -> Result<()> {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let big = MAX_MONEY * 2;
|
let big = MAX_MONEY * 2;
|
||||||
let neg = -10;
|
let neg = -10;
|
||||||
|
|
||||||
|
@ -572,6 +585,8 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn hash() -> Result<()> {
|
fn hash() -> Result<()> {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let one = Amount::<NonNegative>::try_from(1)?;
|
let one = Amount::<NonNegative>::try_from(1)?;
|
||||||
let another_one = Amount::<NonNegative>::try_from(1)?;
|
let another_one = Amount::<NonNegative>::try_from(1)?;
|
||||||
let zero = Amount::<NonNegative>::try_from(0)?;
|
let zero = Amount::<NonNegative>::try_from(0)?;
|
||||||
|
@ -601,6 +616,8 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn ordering_constraints() -> Result<()> {
|
fn ordering_constraints() -> Result<()> {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
ordering::<NonNegative, NonNegative>()?;
|
ordering::<NonNegative, NonNegative>()?;
|
||||||
ordering::<NonNegative, NegativeAllowed>()?;
|
ordering::<NonNegative, NegativeAllowed>()?;
|
||||||
ordering::<NegativeAllowed, NonNegative>()?;
|
ordering::<NegativeAllowed, NonNegative>()?;
|
||||||
|
|
|
@ -132,6 +132,8 @@ impl Arbitrary for Height {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn operator_tests() {
|
fn operator_tests() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
assert_eq!(Some(Height(2)), Height(1) + Height(1));
|
assert_eq!(Some(Height(2)), Height(1) + Height(1));
|
||||||
assert_eq!(None, Height::MAX + Height(1));
|
assert_eq!(None, Height::MAX + Height(1));
|
||||||
// Bad heights aren't caught at compile-time or runtime, until we add or subtract
|
// Bad heights aren't caught at compile-time or runtime, until we add or subtract
|
||||||
|
|
|
@ -12,6 +12,8 @@ use super::super::{serialize::MAX_BLOCK_BYTES, *};
|
||||||
proptest! {
|
proptest! {
|
||||||
#[test]
|
#[test]
|
||||||
fn block_hash_roundtrip(hash in any::<Hash>()) {
|
fn block_hash_roundtrip(hash in any::<Hash>()) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let bytes = hash.zcash_serialize_to_vec()?;
|
let bytes = hash.zcash_serialize_to_vec()?;
|
||||||
let other_hash: Hash = bytes.zcash_deserialize_into()?;
|
let other_hash: Hash = bytes.zcash_deserialize_into()?;
|
||||||
|
|
||||||
|
@ -20,6 +22,8 @@ proptest! {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn block_hash_display_fromstr_roundtrip(hash in any::<Hash>()) {
|
fn block_hash_display_fromstr_roundtrip(hash in any::<Hash>()) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let display = format!("{}", hash);
|
let display = format!("{}", hash);
|
||||||
let parsed = display.parse::<Hash>().expect("hash should parse");
|
let parsed = display.parse::<Hash>().expect("hash should parse");
|
||||||
prop_assert_eq!(hash, parsed);
|
prop_assert_eq!(hash, parsed);
|
||||||
|
@ -27,6 +31,8 @@ proptest! {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn blockheader_roundtrip(header in any::<Header>()) {
|
fn blockheader_roundtrip(header in any::<Header>()) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let bytes = header.zcash_serialize_to_vec()?;
|
let bytes = header.zcash_serialize_to_vec()?;
|
||||||
let other_header = bytes.zcash_deserialize_into()?;
|
let other_header = bytes.zcash_deserialize_into()?;
|
||||||
|
|
||||||
|
@ -39,6 +45,8 @@ proptest! {
|
||||||
network in any::<Network>(),
|
network in any::<Network>(),
|
||||||
block_height in any::<Height>()
|
block_height in any::<Height>()
|
||||||
) {
|
) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let root_hash = RootHash::from_bytes(bytes, network, block_height);
|
let root_hash = RootHash::from_bytes(bytes, network, block_height);
|
||||||
let other_bytes = root_hash.to_bytes();
|
let other_bytes = root_hash.to_bytes();
|
||||||
|
|
||||||
|
@ -56,6 +64,8 @@ proptest! {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn block_roundtrip(block in any::<Block>(), network in any::<Network>()) {
|
fn block_roundtrip(block in any::<Block>(), network in any::<Network>()) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let bytes = block.zcash_serialize_to_vec()?;
|
let bytes = block.zcash_serialize_to_vec()?;
|
||||||
let bytes = &mut bytes.as_slice();
|
let bytes = &mut bytes.as_slice();
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@ use super::generate; // XXX this should be rewritten as strategies
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn blockheaderhash_debug() {
|
fn blockheaderhash_debug() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let preimage = b"foo bar baz";
|
let preimage = b"foo bar baz";
|
||||||
let mut sha_writer = sha256d::Writer::default();
|
let mut sha_writer = sha256d::Writer::default();
|
||||||
let _ = sha_writer.write_all(preimage);
|
let _ = sha_writer.write_all(preimage);
|
||||||
|
@ -25,6 +27,8 @@ fn blockheaderhash_debug() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn blockheaderhash_from_blockheader() {
|
fn blockheaderhash_from_blockheader() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let blockheader = generate::block_header();
|
let blockheader = generate::block_header();
|
||||||
|
|
||||||
let hash = Hash::from(&blockheader);
|
let hash = Hash::from(&blockheader);
|
||||||
|
@ -69,6 +73,8 @@ fn deserialize_blockheader() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn deserialize_block() {
|
fn deserialize_block() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
// this one has a bad version field
|
// this one has a bad version field
|
||||||
zebra_test::vectors::BLOCK_MAINNET_434873_BYTES
|
zebra_test::vectors::BLOCK_MAINNET_434873_BYTES
|
||||||
.zcash_deserialize_into::<Block>()
|
.zcash_deserialize_into::<Block>()
|
||||||
|
@ -83,6 +89,8 @@ fn deserialize_block() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn block_test_vectors_unique() {
|
fn block_test_vectors_unique() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let block_count = zebra_test::vectors::BLOCKS.len();
|
let block_count = zebra_test::vectors::BLOCKS.len();
|
||||||
let block_hashes: HashSet<_> = zebra_test::vectors::BLOCKS
|
let block_hashes: HashSet<_> = zebra_test::vectors::BLOCKS
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -103,11 +111,15 @@ fn block_test_vectors_unique() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn block_test_vectors_height_mainnet() {
|
fn block_test_vectors_height_mainnet() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
block_test_vectors_height(Network::Mainnet);
|
block_test_vectors_height(Network::Mainnet);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn block_test_vectors_height_testnet() {
|
fn block_test_vectors_height_testnet() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
block_test_vectors_height(Network::Testnet);
|
block_test_vectors_height(Network::Testnet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,6 +143,8 @@ fn block_test_vectors_height(network: Network) {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn block_limits_multi_tx() {
|
fn block_limits_multi_tx() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
// Test multiple small transactions to fill a block max size
|
// Test multiple small transactions to fill a block max size
|
||||||
|
|
||||||
// Create a block just below the limit
|
// Create a block just below the limit
|
||||||
|
@ -166,6 +180,8 @@ fn block_limits_multi_tx() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn block_limits_single_tx() {
|
fn block_limits_single_tx() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
// Test block limit with a big single transaction
|
// Test block limit with a big single transaction
|
||||||
|
|
||||||
// Create a block just below the limit
|
// Create a block just below the limit
|
||||||
|
@ -213,6 +229,8 @@ fn node_time_check(
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn time_check_now() {
|
fn time_check_now() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
// These checks are deteministic, because all the times are offset
|
// These checks are deteministic, because all the times are offset
|
||||||
// from the current time.
|
// from the current time.
|
||||||
let now = Utc::now();
|
let now = Utc::now();
|
||||||
|
@ -273,6 +291,8 @@ static BLOCK_HEADER_INVALID_TIMESTAMPS: &[i64] = &[
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn time_check_fixed() {
|
fn time_check_fixed() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
// These checks are non-deterministic, but the times are all in the
|
// These checks are non-deterministic, but the times are all in the
|
||||||
// distant past or far future. So it's unlikely that the test
|
// distant past or far future. So it's unlikely that the test
|
||||||
// machine will have a clock that makes these tests fail.
|
// machine will have a clock that makes these tests fail.
|
||||||
|
|
|
@ -12,6 +12,8 @@ use NetworkUpgrade::*;
|
||||||
/// Check that the activation heights and network upgrades are unique.
|
/// Check that the activation heights and network upgrades are unique.
|
||||||
#[test]
|
#[test]
|
||||||
fn activation_bijective() {
|
fn activation_bijective() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let mainnet_activations = NetworkUpgrade::activation_list(Mainnet);
|
let mainnet_activations = NetworkUpgrade::activation_list(Mainnet);
|
||||||
let mainnet_heights: HashSet<&block::Height> = mainnet_activations.keys().collect();
|
let mainnet_heights: HashSet<&block::Height> = mainnet_activations.keys().collect();
|
||||||
assert_eq!(MAINNET_ACTIVATION_HEIGHTS.len(), mainnet_heights.len());
|
assert_eq!(MAINNET_ACTIVATION_HEIGHTS.len(), mainnet_heights.len());
|
||||||
|
@ -29,11 +31,13 @@ fn activation_bijective() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn activation_extremes_mainnet() {
|
fn activation_extremes_mainnet() {
|
||||||
|
zebra_test::init();
|
||||||
activation_extremes(Mainnet)
|
activation_extremes(Mainnet)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn activation_extremes_testnet() {
|
fn activation_extremes_testnet() {
|
||||||
|
zebra_test::init();
|
||||||
activation_extremes(Testnet)
|
activation_extremes(Testnet)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,11 +88,13 @@ fn activation_extremes(network: Network) {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn activation_consistent_mainnet() {
|
fn activation_consistent_mainnet() {
|
||||||
|
zebra_test::init();
|
||||||
activation_consistent(Mainnet)
|
activation_consistent(Mainnet)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn activation_consistent_testnet() {
|
fn activation_consistent_testnet() {
|
||||||
|
zebra_test::init();
|
||||||
activation_consistent(Testnet)
|
activation_consistent(Testnet)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,6 +125,8 @@ fn activation_consistent(network: Network) {
|
||||||
/// Check that the network upgrades and branch ids are unique.
|
/// Check that the network upgrades and branch ids are unique.
|
||||||
#[test]
|
#[test]
|
||||||
fn branch_id_bijective() {
|
fn branch_id_bijective() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let branch_id_list = NetworkUpgrade::branch_id_list();
|
let branch_id_list = NetworkUpgrade::branch_id_list();
|
||||||
let nus: HashSet<&NetworkUpgrade> = branch_id_list.keys().collect();
|
let nus: HashSet<&NetworkUpgrade> = branch_id_list.keys().collect();
|
||||||
assert_eq!(CONSENSUS_BRANCH_IDS.len(), nus.len());
|
assert_eq!(CONSENSUS_BRANCH_IDS.len(), nus.len());
|
||||||
|
@ -129,11 +137,13 @@ fn branch_id_bijective() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn branch_id_extremes_mainnet() {
|
fn branch_id_extremes_mainnet() {
|
||||||
|
zebra_test::init();
|
||||||
branch_id_extremes(Mainnet)
|
branch_id_extremes(Mainnet)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn branch_id_extremes_testnet() {
|
fn branch_id_extremes_testnet() {
|
||||||
|
zebra_test::init();
|
||||||
branch_id_extremes(Testnet)
|
branch_id_extremes(Testnet)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,11 +175,13 @@ fn branch_id_extremes(network: Network) {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn branch_id_consistent_mainnet() {
|
fn branch_id_consistent_mainnet() {
|
||||||
|
zebra_test::init();
|
||||||
branch_id_consistent(Mainnet)
|
branch_id_consistent(Mainnet)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn branch_id_consistent_testnet() {
|
fn branch_id_consistent_testnet() {
|
||||||
|
zebra_test::init();
|
||||||
branch_id_consistent(Testnet)
|
branch_id_consistent(Testnet)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,6 +119,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn from_str_display() {
|
fn from_str_display() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let zs_addr: Address =
|
let zs_addr: Address =
|
||||||
"zs1qqqqqqqqqqqqqqqqqrjq05nyfku05msvu49mawhg6kr0wwljahypwyk2h88z6975u563j8nfaxd"
|
"zs1qqqqqqqqqqqqqqqqqrjq05nyfku05msvu49mawhg6kr0wwljahypwyk2h88z6975u563j8nfaxd"
|
||||||
.parse()
|
.parse()
|
||||||
|
@ -132,6 +134,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn derive_keys_and_addresses() {
|
fn derive_keys_and_addresses() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let spending_key = keys::SpendingKey::new(&mut OsRng);
|
let spending_key = keys::SpendingKey::new(&mut OsRng);
|
||||||
|
|
||||||
let spend_authorizing_key = keys::SpendAuthorizingKey::from(spending_key);
|
let spend_authorizing_key = keys::SpendAuthorizingKey::from(spending_key);
|
||||||
|
@ -158,6 +162,7 @@ proptest! {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn sapling_address_roundtrip(zaddr in any::<Address>()) {
|
fn sapling_address_roundtrip(zaddr in any::<Address>()) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let string = zaddr.to_string();
|
let string = zaddr.to_string();
|
||||||
|
|
||||||
|
|
|
@ -288,6 +288,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn pedersen_hash_to_point_test_vectors() {
|
fn pedersen_hash_to_point_test_vectors() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
const D: [u8; 8] = *b"Zcash_PH";
|
const D: [u8; 8] = *b"Zcash_PH";
|
||||||
|
|
||||||
for test_vector in test_vectors::TEST_VECTORS.iter() {
|
for test_vector in test_vectors::TEST_VECTORS.iter() {
|
||||||
|
@ -302,6 +304,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn add() {
|
fn add() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let identity = ValueCommitment(jubjub::AffinePoint::identity());
|
let identity = ValueCommitment(jubjub::AffinePoint::identity());
|
||||||
|
|
||||||
let g = ValueCommitment(jubjub::AffinePoint::from_raw_unchecked(
|
let g = ValueCommitment(jubjub::AffinePoint::from_raw_unchecked(
|
||||||
|
@ -324,6 +328,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn add_assign() {
|
fn add_assign() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let mut identity = ValueCommitment(jubjub::AffinePoint::identity());
|
let mut identity = ValueCommitment(jubjub::AffinePoint::identity());
|
||||||
|
|
||||||
let g = ValueCommitment(jubjub::AffinePoint::from_raw_unchecked(
|
let g = ValueCommitment(jubjub::AffinePoint::from_raw_unchecked(
|
||||||
|
@ -349,6 +355,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn sub() {
|
fn sub() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let g_point = jubjub::AffinePoint::from_raw_unchecked(
|
let g_point = jubjub::AffinePoint::from_raw_unchecked(
|
||||||
jubjub::Fq::from_raw([
|
jubjub::Fq::from_raw([
|
||||||
0xe4b3_d35d_f1a7_adfe,
|
0xe4b3_d35d_f1a7_adfe,
|
||||||
|
@ -373,6 +381,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn sub_assign() {
|
fn sub_assign() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let g_point = jubjub::AffinePoint::from_raw_unchecked(
|
let g_point = jubjub::AffinePoint::from_raw_unchecked(
|
||||||
jubjub::Fq::from_raw([
|
jubjub::Fq::from_raw([
|
||||||
0xe4b3_d35d_f1a7_adfe,
|
0xe4b3_d35d_f1a7_adfe,
|
||||||
|
@ -400,6 +410,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn sum() {
|
fn sum() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let g_point = jubjub::AffinePoint::from_raw_unchecked(
|
let g_point = jubjub::AffinePoint::from_raw_unchecked(
|
||||||
jubjub::Fq::from_raw([
|
jubjub::Fq::from_raw([
|
||||||
0xe4b3_d35d_f1a7_adfe,
|
0xe4b3_d35d_f1a7_adfe,
|
||||||
|
|
|
@ -37,6 +37,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn derive_for_each_test_vector() {
|
fn derive_for_each_test_vector() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
for test_vector in test_vectors::TEST_VECTORS.iter() {
|
for test_vector in test_vectors::TEST_VECTORS.iter() {
|
||||||
let spending_key = SpendingKey::from(test_vector.sk);
|
let spending_key = SpendingKey::from(test_vector.sk);
|
||||||
|
|
||||||
|
@ -76,6 +78,8 @@ proptest! {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn string_roundtrips(spending_key in any::<SpendingKey>()) {
|
fn string_roundtrips(spending_key in any::<SpendingKey>()) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let sk_string = spending_key.to_string();
|
let sk_string = spending_key.to_string();
|
||||||
let spending_key_2: SpendingKey = sk_string.parse().unwrap();
|
let spending_key_2: SpendingKey = sk_string.parse().unwrap();
|
||||||
prop_assert_eq![spending_key, spending_key_2];
|
prop_assert_eq![spending_key, spending_key_2];
|
||||||
|
|
|
@ -107,6 +107,7 @@ proptest! {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn encrypted_ciphertext_roundtrip(ec in any::<EncryptedNote>()) {
|
fn encrypted_ciphertext_roundtrip(ec in any::<EncryptedNote>()) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let mut data = Vec::new();
|
let mut data = Vec::new();
|
||||||
|
|
||||||
|
@ -119,6 +120,7 @@ proptest! {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn out_ciphertext_roundtrip(oc in any::<WrappedNoteKey>()) {
|
fn out_ciphertext_roundtrip(oc in any::<WrappedNoteKey>()) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let mut data = Vec::new();
|
let mut data = Vec::new();
|
||||||
|
|
||||||
|
|
|
@ -161,6 +161,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn empty_roots() {
|
fn empty_roots() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
// From https://github.com/zcash/librustzcash/blob/master/zcash_primitives/src/merkle_tree.rs#L512
|
// From https://github.com/zcash/librustzcash/blob/master/zcash_primitives/src/merkle_tree.rs#L512
|
||||||
const HEX_EMPTY_ROOTS: [&str; 33] = [
|
const HEX_EMPTY_ROOTS: [&str; 33] = [
|
||||||
"0100000000000000000000000000000000000000000000000000000000000000",
|
"0100000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
@ -205,6 +207,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn incremental_roots() {
|
fn incremental_roots() {
|
||||||
|
zebra_test::init();
|
||||||
// From https://github.com/zcash/zcash/blob/master/src/test/data/merkle_commitments_sapling.json
|
// From https://github.com/zcash/zcash/blob/master/src/test/data/merkle_commitments_sapling.json
|
||||||
// Byte-reversed from those ones because the original test vectors are loaded using uint256S()
|
// Byte-reversed from those ones because the original test vectors are loaded using uint256S()
|
||||||
let commitments = [
|
let commitments = [
|
||||||
|
|
|
@ -11,6 +11,8 @@ proptest! {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn compactsize_write_then_read_round_trip(s in 0u64..0x2_0000u64) {
|
fn compactsize_write_then_read_round_trip(s in 0u64..0x2_0000u64) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
// Maximum encoding size of a compactsize is 9 bytes.
|
// Maximum encoding size of a compactsize is 9 bytes.
|
||||||
let mut buf = [0u8; 8+1];
|
let mut buf = [0u8; 8+1];
|
||||||
Cursor::new(&mut buf[..]).write_compactsize(s).unwrap();
|
Cursor::new(&mut buf[..]).write_compactsize(s).unwrap();
|
||||||
|
@ -20,6 +22,8 @@ proptest! {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn compactsize_read_then_write_round_trip(bytes in prop::array::uniform9(0u8..)) {
|
fn compactsize_read_then_write_round_trip(bytes in prop::array::uniform9(0u8..)) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
// Only do the test if the bytes were valid.
|
// Only do the test if the bytes were valid.
|
||||||
if let Ok(s) = Cursor::new(&bytes[..]).read_compactsize() {
|
if let Ok(s) = Cursor::new(&bytes[..]).read_compactsize() {
|
||||||
// The compactsize encoding is variable-length, so we may not even
|
// The compactsize encoding is variable-length, so we may not even
|
||||||
|
|
|
@ -60,6 +60,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn sha256d_checksum() {
|
fn sha256d_checksum() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
// https://en.bitcoin.it/wiki/Protocol_documentation#Hashes
|
// https://en.bitcoin.it/wiki/Protocol_documentation#Hashes
|
||||||
let input = b"hello";
|
let input = b"hello";
|
||||||
let checksum = Checksum::from(&input[..]);
|
let checksum = Checksum::from(&input[..]);
|
||||||
|
@ -69,6 +71,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn sha256d_checksum_debug() {
|
fn sha256d_checksum_debug() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let input = b"hello";
|
let input = b"hello";
|
||||||
let checksum = Checksum::from(&input[..]);
|
let checksum = Checksum::from(&input[..]);
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn from_string_debug() {
|
fn from_string_debug() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let string = "zcU1Cd6zYyZCd2VJF8yKgmzjxdiiU1rgTTjEwoN1CGUWCziPkUTXUjXmX7TMqdMNsTfuiGN1jQoVN4kGxUR4sAPN4XZ7pxb";
|
let string = "zcU1Cd6zYyZCd2VJF8yKgmzjxdiiU1rgTTjEwoN1CGUWCziPkUTXUjXmX7TMqdMNsTfuiGN1jQoVN4kGxUR4sAPN4XZ7pxb";
|
||||||
let zc_addr = string.parse::<SproutShieldedAddress>().unwrap();
|
let zc_addr = string.parse::<SproutShieldedAddress>().unwrap();
|
||||||
|
|
||||||
|
@ -150,6 +152,7 @@ proptest! {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn zcash_de_serialize_roundtrip(zaddr in any::<SproutShieldedAddress>()) {
|
fn zcash_de_serialize_roundtrip(zaddr in any::<SproutShieldedAddress>()) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let mut data = Vec::new();
|
let mut data = Vec::new();
|
||||||
|
|
||||||
|
@ -163,6 +166,7 @@ proptest! {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn zcash_base58check_roundtrip(zaddr in any::<SproutShieldedAddress>()) {
|
fn zcash_base58check_roundtrip(zaddr in any::<SproutShieldedAddress>()) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let string = zaddr.to_string();
|
let string = zaddr.to_string();
|
||||||
|
|
||||||
|
|
|
@ -344,6 +344,8 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
// TODO: test vectors, not just random data
|
// TODO: test vectors, not just random data
|
||||||
fn derive_keys() {
|
fn derive_keys() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let spending_key = SpendingKey::new(&mut OsRng);
|
let spending_key = SpendingKey::new(&mut OsRng);
|
||||||
|
|
||||||
let receiving_key = ReceivingKey::from(spending_key);
|
let receiving_key = ReceivingKey::from(spending_key);
|
||||||
|
@ -357,6 +359,7 @@ proptest! {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn spending_key_roundtrip(sk in any::<SpendingKey>()) {
|
fn spending_key_roundtrip(sk in any::<SpendingKey>()) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let mut data = Vec::new();
|
let mut data = Vec::new();
|
||||||
|
|
||||||
|
@ -370,6 +373,7 @@ proptest! {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn spending_key_string_roundtrip(sk in any::<SpendingKey>()) {
|
fn spending_key_string_roundtrip(sk in any::<SpendingKey>()) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let string = sk.to_string();
|
let string = sk.to_string();
|
||||||
|
|
||||||
|
@ -381,6 +385,7 @@ proptest! {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn incoming_viewing_key_roundtrip(ivk in any::<IncomingViewingKey>()) {
|
fn incoming_viewing_key_roundtrip(ivk in any::<IncomingViewingKey>()) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let mut data = Vec::new();
|
let mut data = Vec::new();
|
||||||
|
|
||||||
|
@ -394,6 +399,7 @@ proptest! {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn incoming_viewing_key_string_roundtrip(ivk in any::<IncomingViewingKey>()) {
|
fn incoming_viewing_key_string_roundtrip(ivk in any::<IncomingViewingKey>()) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let string = ivk.to_string();
|
let string = ivk.to_string();
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,7 @@ proptest! {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn encrypted_ciphertext_roundtrip(ec in any::<EncryptedNote>()) {
|
fn encrypted_ciphertext_roundtrip(ec in any::<EncryptedNote>()) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let mut data = Vec::new();
|
let mut data = Vec::new();
|
||||||
|
|
||||||
|
|
|
@ -176,6 +176,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn empty_roots() {
|
fn empty_roots() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
// From https://github.com/zcash/zcash/blob/master/src/zcash/IncrementalMerkleTree.cpp#L439
|
// From https://github.com/zcash/zcash/blob/master/src/zcash/IncrementalMerkleTree.cpp#L439
|
||||||
let hex_empty_roots = [
|
let hex_empty_roots = [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
@ -217,6 +219,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn incremental_roots() {
|
fn incremental_roots() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
// From https://github.com/zcash/zcash/blob/master/src/test/data/merkle_commitments.json
|
// From https://github.com/zcash/zcash/blob/master/src/test/data/merkle_commitments.json
|
||||||
//
|
//
|
||||||
// Byte-reversed from those ones because the original test vectors are
|
// Byte-reversed from those ones because the original test vectors are
|
||||||
|
|
|
@ -65,6 +65,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn transactionhash_from_str() {
|
fn transactionhash_from_str() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let hash: Hash = "3166411bd5343e0b284a108f39a929fbbb62619784f8c6dafe520703b5b446bf"
|
let hash: Hash = "3166411bd5343e0b284a108f39a929fbbb62619784f8c6dafe520703b5b446bf"
|
||||||
.parse()
|
.parse()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
@ -50,6 +50,8 @@ impl fmt::Debug for Memo {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn memo_fmt() {
|
fn memo_fmt() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let memo = Memo(Box::new(
|
let memo = Memo(Box::new(
|
||||||
*b"thiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis \
|
*b"thiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis \
|
||||||
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis \
|
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis \
|
||||||
|
@ -74,6 +76,8 @@ fn memo_fmt() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn memo_from_string() {
|
fn memo_from_string() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let memo = Memo::try_from("foo bar baz".as_ref()).unwrap();
|
let memo = Memo::try_from("foo bar baz".as_ref()).unwrap();
|
||||||
|
|
||||||
let mut bytes = [0; 512];
|
let mut bytes = [0; 512];
|
||||||
|
|
|
@ -8,6 +8,8 @@ use crate::serialization::{ZcashDeserialize, ZcashDeserializeInto, ZcashSerializ
|
||||||
proptest! {
|
proptest! {
|
||||||
#[test]
|
#[test]
|
||||||
fn transaction_roundtrip(tx in any::<Transaction>()) {
|
fn transaction_roundtrip(tx in any::<Transaction>()) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let data = tx.zcash_serialize_to_vec().expect("tx should serialize");
|
let data = tx.zcash_serialize_to_vec().expect("tx should serialize");
|
||||||
let tx2 = data.zcash_deserialize_into().expect("randomized tx should deserialize");
|
let tx2 = data.zcash_deserialize_into().expect("randomized tx should deserialize");
|
||||||
|
|
||||||
|
@ -16,6 +18,8 @@ proptest! {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn transaction_hash_display_fromstr_roundtrip(hash in any::<Hash>()) {
|
fn transaction_hash_display_fromstr_roundtrip(hash in any::<Hash>()) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let display = format!("{}", hash);
|
let display = format!("{}", hash);
|
||||||
let parsed = display.parse::<Hash>().expect("hash should parse");
|
let parsed = display.parse::<Hash>().expect("hash should parse");
|
||||||
prop_assert_eq!(hash, parsed);
|
prop_assert_eq!(hash, parsed);
|
||||||
|
@ -23,6 +27,8 @@ proptest! {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn locktime_roundtrip(locktime in any::<LockTime>()) {
|
fn locktime_roundtrip(locktime in any::<LockTime>()) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let mut bytes = Cursor::new(Vec::new());
|
let mut bytes = Cursor::new(Vec::new());
|
||||||
locktime.zcash_serialize(&mut bytes)?;
|
locktime.zcash_serialize(&mut bytes)?;
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@ use crate::serialization::{ZcashDeserialize, ZcashSerialize};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn librustzcash_tx_deserialize_and_round_trip() {
|
fn librustzcash_tx_deserialize_and_round_trip() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let tx = Transaction::zcash_deserialize(&zebra_test::vectors::GENERIC_TESTNET_TX[..])
|
let tx = Transaction::zcash_deserialize(&zebra_test::vectors::GENERIC_TESTNET_TX[..])
|
||||||
.expect("transaction test vector from librustzcash should deserialize");
|
.expect("transaction test vector from librustzcash should deserialize");
|
||||||
|
|
||||||
|
@ -15,6 +17,8 @@ fn librustzcash_tx_deserialize_and_round_trip() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn librustzcash_tx_hash() {
|
fn librustzcash_tx_hash() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let tx = Transaction::zcash_deserialize(&zebra_test::vectors::GENERIC_TESTNET_TX[..])
|
let tx = Transaction::zcash_deserialize(&zebra_test::vectors::GENERIC_TESTNET_TX[..])
|
||||||
.expect("transaction test vector from librustzcash should deserialize");
|
.expect("transaction test vector from librustzcash should deserialize");
|
||||||
|
|
||||||
|
@ -29,6 +33,8 @@ fn librustzcash_tx_hash() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn zip143_deserialize_and_round_trip() {
|
fn zip143_deserialize_and_round_trip() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let tx1 = Transaction::zcash_deserialize(&zebra_test::vectors::ZIP143_1[..])
|
let tx1 = Transaction::zcash_deserialize(&zebra_test::vectors::ZIP143_1[..])
|
||||||
.expect("transaction test vector from ZIP143 should deserialize");
|
.expect("transaction test vector from ZIP143 should deserialize");
|
||||||
|
|
||||||
|
@ -50,6 +56,8 @@ fn zip143_deserialize_and_round_trip() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn zip243_deserialize_and_round_trip() {
|
fn zip243_deserialize_and_round_trip() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let tx1 = Transaction::zcash_deserialize(&zebra_test::vectors::ZIP243_1[..])
|
let tx1 = Transaction::zcash_deserialize(&zebra_test::vectors::ZIP243_1[..])
|
||||||
.expect("transaction test vector from ZIP243 should deserialize");
|
.expect("transaction test vector from ZIP243 should deserialize");
|
||||||
|
|
||||||
|
|
|
@ -257,6 +257,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn pubkey_mainnet() {
|
fn pubkey_mainnet() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let pub_key = PublicKey::from_slice(&[
|
let pub_key = PublicKey::from_slice(&[
|
||||||
3, 23, 183, 225, 206, 31, 159, 148, 195, 42, 67, 115, 146, 41, 248, 140, 11, 3, 51, 41,
|
3, 23, 183, 225, 206, 31, 159, 148, 195, 42, 67, 115, 146, 41, 248, 140, 11, 3, 51, 41,
|
||||||
111, 180, 110, 143, 114, 134, 88, 73, 198, 174, 52, 184, 78,
|
111, 180, 110, 143, 114, 134, 88, 73, 198, 174, 52, 184, 78,
|
||||||
|
@ -270,6 +272,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn pubkey_testnet() {
|
fn pubkey_testnet() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let pub_key = PublicKey::from_slice(&[
|
let pub_key = PublicKey::from_slice(&[
|
||||||
3, 23, 183, 225, 206, 31, 159, 148, 195, 42, 67, 115, 146, 41, 248, 140, 11, 3, 51, 41,
|
3, 23, 183, 225, 206, 31, 159, 148, 195, 42, 67, 115, 146, 41, 248, 140, 11, 3, 51, 41,
|
||||||
111, 180, 110, 143, 114, 134, 88, 73, 198, 174, 52, 184, 78,
|
111, 180, 110, 143, 114, 134, 88, 73, 198, 174, 52, 184, 78,
|
||||||
|
@ -283,6 +287,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn empty_script_mainnet() {
|
fn empty_script_mainnet() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let script = Script(vec![0; 20]);
|
let script = Script(vec![0; 20]);
|
||||||
|
|
||||||
let t_addr = script.to_address(Network::Mainnet);
|
let t_addr = script.to_address(Network::Mainnet);
|
||||||
|
@ -292,6 +298,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn empty_script_testnet() {
|
fn empty_script_testnet() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let script = Script(vec![0; 20]);
|
let script = Script(vec![0; 20]);
|
||||||
|
|
||||||
let t_addr = script.to_address(Network::Testnet);
|
let t_addr = script.to_address(Network::Testnet);
|
||||||
|
@ -301,6 +309,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn from_string() {
|
fn from_string() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let t_addr: Address = "t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd".parse().unwrap();
|
let t_addr: Address = "t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd".parse().unwrap();
|
||||||
|
|
||||||
assert_eq!(format!("{}", t_addr), "t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd");
|
assert_eq!(format!("{}", t_addr), "t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd");
|
||||||
|
@ -308,6 +318,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn debug() {
|
fn debug() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let t_addr: Address = "t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd".parse().unwrap();
|
let t_addr: Address = "t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd".parse().unwrap();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -322,6 +334,7 @@ proptest! {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn transparent_address_roundtrip(taddr in any::<Address>()) {
|
fn transparent_address_roundtrip(taddr in any::<Address>()) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let mut data = Vec::new();
|
let mut data = Vec::new();
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,8 @@ mod proptests {
|
||||||
proptest! {
|
proptest! {
|
||||||
#[test]
|
#[test]
|
||||||
fn script_roundtrip(script in any::<Script>()) {
|
fn script_roundtrip(script in any::<Script>()) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let mut bytes = Cursor::new(Vec::new());
|
let mut bytes = Cursor::new(Vec::new());
|
||||||
script.zcash_serialize(&mut bytes)?;
|
script.zcash_serialize(&mut bytes)?;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ use super::super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn equihash_solution_roundtrip() {
|
fn equihash_solution_roundtrip() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
proptest!(|(solution in any::<equihash::Solution>())| {
|
proptest!(|(solution in any::<equihash::Solution>())| {
|
||||||
let data = solution
|
let data = solution
|
||||||
.zcash_serialize_to_vec()
|
.zcash_serialize_to_vec()
|
||||||
|
|
|
@ -33,6 +33,8 @@ mod test {
|
||||||
use zebra_chain::parameters::NetworkUpgrade::*;
|
use zebra_chain::parameters::NetworkUpgrade::*;
|
||||||
#[test]
|
#[test]
|
||||||
fn test_founders_reward() -> Result<(), Report> {
|
fn test_founders_reward() -> Result<(), Report> {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let network = Network::Mainnet;
|
let network = Network::Mainnet;
|
||||||
let blossom_height = Blossom.activation_height(network).unwrap();
|
let blossom_height = Blossom.activation_height(network).unwrap();
|
||||||
let canopy_height = Canopy.activation_height(network).unwrap();
|
let canopy_height = Canopy.activation_height(network).unwrap();
|
||||||
|
|
|
@ -109,6 +109,8 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn halving_test() -> Result<(), Report> {
|
fn halving_test() -> Result<(), Report> {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
halving_for_network(Network::Mainnet)?;
|
halving_for_network(Network::Mainnet)?;
|
||||||
halving_for_network(Network::Testnet)?;
|
halving_for_network(Network::Testnet)?;
|
||||||
|
|
||||||
|
@ -194,6 +196,8 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn block_subsidy_test() -> Result<(), Report> {
|
fn block_subsidy_test() -> Result<(), Report> {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
block_subsidy_for_network(Network::Mainnet)?;
|
block_subsidy_for_network(Network::Mainnet)?;
|
||||||
block_subsidy_for_network(Network::Testnet)?;
|
block_subsidy_for_network(Network::Testnet)?;
|
||||||
|
|
||||||
|
@ -283,6 +287,8 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn miner_subsidy_test() -> Result<(), Report> {
|
fn miner_subsidy_test() -> Result<(), Report> {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
miner_subsidy_for_network(Network::Mainnet)?;
|
miner_subsidy_for_network(Network::Mainnet)?;
|
||||||
miner_subsidy_for_network(Network::Testnet)?;
|
miner_subsidy_for_network(Network::Testnet)?;
|
||||||
|
|
||||||
|
|
|
@ -135,6 +135,8 @@ async fn check_transcripts() -> Result<(), Report> {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn coinbase_is_first_for_historical_blocks() -> Result<(), Report> {
|
fn coinbase_is_first_for_historical_blocks() -> Result<(), Report> {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let block_iter = zebra_test::vectors::BLOCKS.iter();
|
let block_iter = zebra_test::vectors::BLOCKS.iter();
|
||||||
|
|
||||||
for block in block_iter {
|
for block in block_iter {
|
||||||
|
@ -151,6 +153,8 @@ fn coinbase_is_first_for_historical_blocks() -> Result<(), Report> {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn difficulty_is_valid_for_historical_blocks() -> Result<(), Report> {
|
fn difficulty_is_valid_for_historical_blocks() -> Result<(), Report> {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
difficulty_is_valid_for_network(Network::Mainnet)?;
|
difficulty_is_valid_for_network(Network::Mainnet)?;
|
||||||
difficulty_is_valid_for_network(Network::Testnet)?;
|
difficulty_is_valid_for_network(Network::Testnet)?;
|
||||||
|
|
||||||
|
@ -177,6 +181,7 @@ fn difficulty_is_valid_for_network(network: Network) -> Result<(), Report> {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn difficulty_validation_failure() -> Result<(), Report> {
|
fn difficulty_validation_failure() -> Result<(), Report> {
|
||||||
|
zebra_test::init();
|
||||||
use crate::error::*;
|
use crate::error::*;
|
||||||
|
|
||||||
// Get a block in the mainnet, and mangle its difficulty field
|
// Get a block in the mainnet, and mangle its difficulty field
|
||||||
|
@ -237,6 +242,8 @@ fn difficulty_validation_failure() -> Result<(), Report> {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn equihash_is_valid_for_historical_blocks() -> Result<(), Report> {
|
fn equihash_is_valid_for_historical_blocks() -> Result<(), Report> {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let block_iter = zebra_test::vectors::BLOCKS.iter();
|
let block_iter = zebra_test::vectors::BLOCKS.iter();
|
||||||
|
|
||||||
for block in block_iter {
|
for block in block_iter {
|
||||||
|
@ -253,6 +260,8 @@ fn equihash_is_valid_for_historical_blocks() -> Result<(), Report> {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn subsidy_is_valid_for_historical_blocks() -> Result<(), Report> {
|
fn subsidy_is_valid_for_historical_blocks() -> Result<(), Report> {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
subsidy_is_valid_for_network(Network::Mainnet)?;
|
subsidy_is_valid_for_network(Network::Mainnet)?;
|
||||||
subsidy_is_valid_for_network(Network::Testnet)?;
|
subsidy_is_valid_for_network(Network::Testnet)?;
|
||||||
|
|
||||||
|
@ -283,6 +292,7 @@ fn subsidy_is_valid_for_network(network: Network) -> Result<(), Report> {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn coinbase_validation_failure() -> Result<(), Report> {
|
fn coinbase_validation_failure() -> Result<(), Report> {
|
||||||
|
zebra_test::init();
|
||||||
use crate::error::*;
|
use crate::error::*;
|
||||||
|
|
||||||
let network = Network::Mainnet;
|
let network = Network::Mainnet;
|
||||||
|
@ -355,6 +365,7 @@ fn coinbase_validation_failure() -> Result<(), Report> {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn founders_reward_validation_failure() -> Result<(), Report> {
|
fn founders_reward_validation_failure() -> Result<(), Report> {
|
||||||
|
zebra_test::init();
|
||||||
use crate::error::*;
|
use crate::error::*;
|
||||||
use zebra_chain::transaction::Transaction;
|
use zebra_chain::transaction::Transaction;
|
||||||
|
|
||||||
|
@ -398,6 +409,8 @@ fn founders_reward_validation_failure() -> Result<(), Report> {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn time_is_valid_for_historical_blocks() -> Result<(), Report> {
|
fn time_is_valid_for_historical_blocks() -> Result<(), Report> {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let block_iter = zebra_test::vectors::BLOCKS.iter();
|
let block_iter = zebra_test::vectors::BLOCKS.iter();
|
||||||
let now = Utc::now();
|
let now = Utc::now();
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ fn minimum_difficulty_testnet() {
|
||||||
|
|
||||||
/// Test MinimumDifficulty
|
/// Test MinimumDifficulty
|
||||||
fn minimum_difficulty(network: Network) {
|
fn minimum_difficulty(network: Network) {
|
||||||
|
zebra_test::init();
|
||||||
use block::Height;
|
use block::Height;
|
||||||
use MinimumDifficulty::*;
|
use MinimumDifficulty::*;
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,8 @@ mod tests {
|
||||||
/// relies on.
|
/// relies on.
|
||||||
#[test]
|
#[test]
|
||||||
fn ensure_live_peer_duration_value_matches_others() {
|
fn ensure_live_peer_duration_value_matches_others() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let constructed_live_peer_duration =
|
let constructed_live_peer_duration =
|
||||||
HEARTBEAT_INTERVAL + REQUEST_TIMEOUT + REQUEST_TIMEOUT + REQUEST_TIMEOUT;
|
HEARTBEAT_INTERVAL + REQUEST_TIMEOUT + REQUEST_TIMEOUT + REQUEST_TIMEOUT;
|
||||||
|
|
||||||
|
@ -122,6 +124,8 @@ mod tests {
|
||||||
/// Make sure that the timeout values are consistent with each other.
|
/// Make sure that the timeout values are consistent with each other.
|
||||||
#[test]
|
#[test]
|
||||||
fn ensure_timeouts_consistent() {
|
fn ensure_timeouts_consistent() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
assert!(HANDSHAKE_TIMEOUT <= REQUEST_TIMEOUT,
|
assert!(HANDSHAKE_TIMEOUT <= REQUEST_TIMEOUT,
|
||||||
"Handshakes are requests, so the handshake timeout can't be longer than the timeout for all requests.");
|
"Handshakes are requests, so the handshake timeout can't be longer than the timeout for all requests.");
|
||||||
// This check is particularly important on testnet, which has a small
|
// This check is particularly important on testnet, which has a small
|
||||||
|
|
|
@ -92,6 +92,8 @@ mod tests {
|
||||||
// XXX remove this test and replace it with a proptest instance.
|
// XXX remove this test and replace it with a proptest instance.
|
||||||
#[test]
|
#[test]
|
||||||
fn sanitize_truncates_timestamps() {
|
fn sanitize_truncates_timestamps() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let entry = MetaAddr {
|
let entry = MetaAddr {
|
||||||
services: PeerServices::default(),
|
services: PeerServices::default(),
|
||||||
addr: "127.0.0.1:8233".parse().unwrap(),
|
addr: "127.0.0.1:8233".parse().unwrap(),
|
||||||
|
|
|
@ -582,6 +582,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn version_message_round_trip() {
|
fn version_message_round_trip() {
|
||||||
|
zebra_test::init();
|
||||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
||||||
let services = PeerServices::NODE_NETWORK;
|
let services = PeerServices::NODE_NETWORK;
|
||||||
let timestamp = Utc.timestamp(1_568_000_000, 0);
|
let timestamp = Utc.timestamp(1_568_000_000, 0);
|
||||||
|
@ -631,6 +632,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn filterload_message_round_trip() {
|
fn filterload_message_round_trip() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let mut rt = Runtime::new().unwrap();
|
let mut rt = Runtime::new().unwrap();
|
||||||
|
|
||||||
let v = Message::FilterLoad {
|
let v = Message::FilterLoad {
|
||||||
|
@ -665,6 +668,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn filterload_message_too_large_round_trip() {
|
fn filterload_message_too_large_round_trip() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let mut rt = Runtime::new().unwrap();
|
let mut rt = Runtime::new().unwrap();
|
||||||
|
|
||||||
let v = Message::FilterLoad {
|
let v = Message::FilterLoad {
|
||||||
|
|
|
@ -122,6 +122,8 @@ mod proptest {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn magic_debug() {
|
fn magic_debug() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
assert_eq!(format!("{:?}", magics::MAINNET), "Magic(\"24e92764\")");
|
assert_eq!(format!("{:?}", magics::MAINNET), "Magic(\"24e92764\")");
|
||||||
assert_eq!(format!("{:?}", magics::TESTNET), "Magic(\"fa1af9bf\")");
|
assert_eq!(format!("{:?}", magics::TESTNET), "Magic(\"fa1af9bf\")");
|
||||||
}
|
}
|
||||||
|
@ -130,6 +132,8 @@ mod proptest {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn proptest_magic_from_array(data in any::<[u8; 4]>()) {
|
fn proptest_magic_from_array(data in any::<[u8; 4]>()) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
assert_eq!(format!("{:?}", Magic(data)), format!("Magic({:x?})", hex::encode(data)));
|
assert_eq!(format!("{:?}", Magic(data)), format!("Magic({:x?})", hex::encode(data)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,6 +156,8 @@ mod test {
|
||||||
/// Test the min_for_upgrade and current_min functions for `network` with
|
/// Test the min_for_upgrade and current_min functions for `network` with
|
||||||
/// extreme values.
|
/// extreme values.
|
||||||
fn version_extremes(network: Network) {
|
fn version_extremes(network: Network) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Version::current_min(network, block::Height(0)),
|
Version::current_min(network, block::Height(0)),
|
||||||
Version::min_for_upgrade(network, BeforeOverwinter),
|
Version::min_for_upgrade(network, BeforeOverwinter),
|
||||||
|
@ -178,6 +184,8 @@ mod test {
|
||||||
/// Check that the min_for_upgrade and current_min functions
|
/// Check that the min_for_upgrade and current_min functions
|
||||||
/// are consistent for `network`.
|
/// are consistent for `network`.
|
||||||
fn version_consistent(network: Network) {
|
fn version_consistent(network: Network) {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let highest_network_upgrade = NetworkUpgrade::current(network, block::Height::MAX);
|
let highest_network_upgrade = NetworkUpgrade::current(network, block::Height::MAX);
|
||||||
assert!(highest_network_upgrade == Canopy || highest_network_upgrade == Heartwood,
|
assert!(highest_network_upgrade == Canopy || highest_network_upgrade == Heartwood,
|
||||||
"expected coverage of all network upgrades: add the new network upgrade to the list in this test");
|
"expected coverage of all network upgrades: add the new network upgrade to the list in this test");
|
||||||
|
|
|
@ -18,6 +18,8 @@ static BLOCK_LOCATOR_CASES: &[(u32, u32)] = &[
|
||||||
/// Check that the block locator heights are sensible.
|
/// Check that the block locator heights are sensible.
|
||||||
#[test]
|
#[test]
|
||||||
fn test_block_locator_heights() {
|
fn test_block_locator_heights() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
for (height, min_height) in BLOCK_LOCATOR_CASES.iter().cloned() {
|
for (height, min_height) in BLOCK_LOCATOR_CASES.iter().cloned() {
|
||||||
let locator = util::block_locator_heights(block::Height(height));
|
let locator = util::block_locator_heights(block::Height(height));
|
||||||
|
|
||||||
|
|
|
@ -404,8 +404,12 @@ mod test {
|
||||||
|
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
|
use crate::init;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn block_test_vectors_unique() {
|
fn block_test_vectors_unique() {
|
||||||
|
init();
|
||||||
|
|
||||||
let block_count = BLOCKS.len();
|
let block_count = BLOCKS.len();
|
||||||
let block_set: HashSet<_> = BLOCKS.iter().collect();
|
let block_set: HashSet<_> = BLOCKS.iter().collect();
|
||||||
|
|
||||||
|
@ -422,6 +426,8 @@ mod test {
|
||||||
/// We're using lazy_static! and combinators, so it would be easy to make this mistake.
|
/// We're using lazy_static! and combinators, so it would be easy to make this mistake.
|
||||||
#[test]
|
#[test]
|
||||||
fn block_test_vectors_count() {
|
fn block_test_vectors_count() {
|
||||||
|
init();
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
BLOCKS.len() > 50,
|
BLOCKS.len() > 50,
|
||||||
"there should be a reasonable number of block test vectors"
|
"there should be a reasonable number of block test vectors"
|
||||||
|
|
|
@ -588,6 +588,8 @@ mod test {
|
||||||
/// Make sure the timeout values are consistent with each other.
|
/// Make sure the timeout values are consistent with each other.
|
||||||
#[test]
|
#[test]
|
||||||
fn ensure_timeouts_consistent() {
|
fn ensure_timeouts_consistent() {
|
||||||
|
zebra_test::init();
|
||||||
|
|
||||||
let max_download_retry_time =
|
let max_download_retry_time =
|
||||||
BLOCK_DOWNLOAD_TIMEOUT.as_secs() * (BLOCK_DOWNLOAD_RETRY_LIMIT as u64);
|
BLOCK_DOWNLOAD_TIMEOUT.as_secs() * (BLOCK_DOWNLOAD_RETRY_LIMIT as u64);
|
||||||
assert!(
|
assert!(
|
||||||
|
|
|
@ -134,6 +134,7 @@ where
|
||||||
#[test]
|
#[test]
|
||||||
fn generate_no_args() -> Result<()> {
|
fn generate_no_args() -> Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
let child = testdir()?
|
let child = testdir()?
|
||||||
.with_config(default_test_config()?)?
|
.with_config(default_test_config()?)?
|
||||||
.spawn_child(&["generate"])?;
|
.spawn_child(&["generate"])?;
|
||||||
|
@ -165,6 +166,7 @@ macro_rules! assert_with_context {
|
||||||
#[test]
|
#[test]
|
||||||
fn generate_args() -> Result<()> {
|
fn generate_args() -> Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
let testdir = testdir()?;
|
let testdir = testdir()?;
|
||||||
let testdir = &testdir;
|
let testdir = &testdir;
|
||||||
|
|
||||||
|
@ -205,6 +207,7 @@ fn generate_args() -> Result<()> {
|
||||||
#[test]
|
#[test]
|
||||||
fn help_no_args() -> Result<()> {
|
fn help_no_args() -> Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
let testdir = testdir()?.with_config(default_test_config()?)?;
|
let testdir = testdir()?.with_config(default_test_config()?)?;
|
||||||
|
|
||||||
let child = testdir.spawn_child(&["help"])?;
|
let child = testdir.spawn_child(&["help"])?;
|
||||||
|
@ -223,6 +226,7 @@ fn help_no_args() -> Result<()> {
|
||||||
#[test]
|
#[test]
|
||||||
fn help_args() -> Result<()> {
|
fn help_args() -> Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
let testdir = testdir()?;
|
let testdir = testdir()?;
|
||||||
let testdir = &testdir;
|
let testdir = &testdir;
|
||||||
|
|
||||||
|
@ -242,6 +246,7 @@ fn help_args() -> Result<()> {
|
||||||
#[test]
|
#[test]
|
||||||
fn start_no_args() -> Result<()> {
|
fn start_no_args() -> Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
// start caches state, so run one of the start tests with persistent state
|
// start caches state, so run one of the start tests with persistent state
|
||||||
let testdir = testdir()?.with_config(persistent_test_config()?)?;
|
let testdir = testdir()?.with_config(persistent_test_config()?)?;
|
||||||
|
|
||||||
|
@ -265,6 +270,7 @@ fn start_no_args() -> Result<()> {
|
||||||
#[test]
|
#[test]
|
||||||
fn start_args() -> Result<()> {
|
fn start_args() -> Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
let testdir = testdir()?.with_config(default_test_config()?)?;
|
let testdir = testdir()?.with_config(default_test_config()?)?;
|
||||||
let testdir = &testdir;
|
let testdir = &testdir;
|
||||||
|
|
||||||
|
@ -291,6 +297,7 @@ fn start_args() -> Result<()> {
|
||||||
#[test]
|
#[test]
|
||||||
fn persistent_mode() -> Result<()> {
|
fn persistent_mode() -> Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
let testdir = testdir()?.with_config(persistent_test_config()?)?;
|
let testdir = testdir()?.with_config(persistent_test_config()?)?;
|
||||||
let testdir = &testdir;
|
let testdir = &testdir;
|
||||||
|
|
||||||
|
@ -314,6 +321,7 @@ fn persistent_mode() -> Result<()> {
|
||||||
#[test]
|
#[test]
|
||||||
fn ephemeral_mode() -> Result<()> {
|
fn ephemeral_mode() -> Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
let testdir = testdir()?.with_config(default_test_config()?)?;
|
let testdir = testdir()?.with_config(default_test_config()?)?;
|
||||||
let testdir = &testdir;
|
let testdir = &testdir;
|
||||||
|
|
||||||
|
@ -378,6 +386,7 @@ fn misconfigured_ephemeral_mode() -> Result<()> {
|
||||||
#[test]
|
#[test]
|
||||||
fn app_no_args() -> Result<()> {
|
fn app_no_args() -> Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
let testdir = testdir()?.with_config(default_test_config()?)?;
|
let testdir = testdir()?.with_config(default_test_config()?)?;
|
||||||
|
|
||||||
let child = testdir.spawn_child(&[])?;
|
let child = testdir.spawn_child(&[])?;
|
||||||
|
@ -392,6 +401,7 @@ fn app_no_args() -> Result<()> {
|
||||||
#[test]
|
#[test]
|
||||||
fn version_no_args() -> Result<()> {
|
fn version_no_args() -> Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
let testdir = testdir()?.with_config(default_test_config()?)?;
|
let testdir = testdir()?.with_config(default_test_config()?)?;
|
||||||
|
|
||||||
let child = testdir.spawn_child(&["version"])?;
|
let child = testdir.spawn_child(&["version"])?;
|
||||||
|
@ -406,6 +416,7 @@ fn version_no_args() -> Result<()> {
|
||||||
#[test]
|
#[test]
|
||||||
fn version_args() -> Result<()> {
|
fn version_args() -> Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
let testdir = testdir()?.with_config(default_test_config()?)?;
|
let testdir = testdir()?.with_config(default_test_config()?)?;
|
||||||
let testdir = &testdir;
|
let testdir = &testdir;
|
||||||
|
|
||||||
|
@ -434,6 +445,7 @@ fn valid_generated_config_test() -> Result<()> {
|
||||||
|
|
||||||
fn valid_generated_config(command: &str, expected_output: &str) -> Result<()> {
|
fn valid_generated_config(command: &str, expected_output: &str) -> Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
let testdir = testdir()?;
|
let testdir = testdir()?;
|
||||||
let testdir = &testdir;
|
let testdir = &testdir;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue