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:
Jamil Lambert, PhD 2025-04-30 17:10:24 +01:00
parent eb7dee831e
commit 9c90bf49c9
No known key found for this signature in database
GPG Key ID: 54DC29234AB5D2C0
1 changed files with 10 additions and 0 deletions

View File

@ -3,6 +3,7 @@
//! Do basic regression tests on the `Display` and `FromStr` impls.
use bitcoin_units::locktime::{absolute, relative};
use bitcoin_units::amount::Denomination;
use bitcoin_units::{Amount, BlockHeight, BlockInterval, FeeRate, SignedAmount, Weight};
macro_rules! check {
@ -24,6 +25,9 @@ check! {
amount_unsigned_one_sat, Amount, Amount::ONE_SAT, "0.00000001 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_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_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_max, Weight, Weight::MAX, "18446744073709551615";
weight_max_block, Weight, Weight::MAX_BLOCK, "4000000";