Add lock by time and denomination display regression tests
The existing display regression tests only tested height locktimes. Denomination display regression and round trip were not tested. Add tests for time locktimes and denomination.
This commit is contained in:
parent
eb7dee831e
commit
9c90bf49c9
|
@ -3,6 +3,7 @@
|
||||||
//! Do basic regression tests on the `Display` and `FromStr` impls.
|
//! Do basic regression tests on the `Display` and `FromStr` impls.
|
||||||
|
|
||||||
use bitcoin_units::locktime::{absolute, relative};
|
use bitcoin_units::locktime::{absolute, relative};
|
||||||
|
use bitcoin_units::amount::Denomination;
|
||||||
use bitcoin_units::{Amount, BlockHeight, BlockInterval, FeeRate, SignedAmount, Weight};
|
use bitcoin_units::{Amount, BlockHeight, BlockInterval, FeeRate, SignedAmount, Weight};
|
||||||
|
|
||||||
macro_rules! check {
|
macro_rules! check {
|
||||||
|
@ -24,6 +25,9 @@ check! {
|
||||||
amount_unsigned_one_sat, Amount, Amount::ONE_SAT, "0.00000001 BTC";
|
amount_unsigned_one_sat, Amount, Amount::ONE_SAT, "0.00000001 BTC";
|
||||||
amount_unsigned_max_money, Amount, Amount::MAX, "21000000 BTC";
|
amount_unsigned_max_money, Amount, Amount::MAX, "21000000 BTC";
|
||||||
|
|
||||||
|
denomination_btc, Denomination, Denomination::BTC, "BTC";
|
||||||
|
denomination_sat, Denomination, Denomination::SAT, "satoshi";
|
||||||
|
|
||||||
amount_signed_one_sat, SignedAmount, SignedAmount::ONE_SAT, "0.00000001 BTC";
|
amount_signed_one_sat, SignedAmount, SignedAmount::ONE_SAT, "0.00000001 BTC";
|
||||||
amount_signed_max_money, SignedAmount, SignedAmount::MAX, "21000000 BTC";
|
amount_signed_max_money, SignedAmount, SignedAmount::MAX, "21000000 BTC";
|
||||||
|
|
||||||
|
@ -43,6 +47,12 @@ check! {
|
||||||
lock_by_height_relative_min, relative::Height, relative::Height::MIN, "0";
|
lock_by_height_relative_min, relative::Height, relative::Height::MIN, "0";
|
||||||
lock_by_height_relative_max, relative::Height, relative::Height::MAX, "65535";
|
lock_by_height_relative_max, relative::Height, relative::Height::MAX, "65535";
|
||||||
|
|
||||||
|
lock_by_time_absolute_min, absolute::Time, absolute::Time::MIN, "500000000";
|
||||||
|
lock_by_time_absolute_max, absolute::Time, absolute::Time::MAX, "4294967295";
|
||||||
|
|
||||||
|
lock_by_time_relative_min, relative::Time, relative::Time::MIN, "0";
|
||||||
|
lock_by_time_relative_max, relative::Time, relative::Time::MAX, "65535";
|
||||||
|
|
||||||
weight_min, Weight, Weight::MIN, "0";
|
weight_min, Weight, Weight::MIN, "0";
|
||||||
weight_max, Weight, Weight::MAX, "18446744073709551615";
|
weight_max, Weight, Weight::MAX, "18446744073709551615";
|
||||||
weight_max_block, Weight, Weight::MAX_BLOCK, "4000000";
|
weight_max_block, Weight, Weight::MAX_BLOCK, "4000000";
|
||||||
|
|
Loading…
Reference in New Issue