420e8c043e Fix mutants in units (Jamil Lambert, PhD)

Pull request description:

  Cargo mutant found missed mutants in the bitcoin constants in both signed and unsigned amounts.

  Add a test to check their values.

ACKs for top commit:
  tcharding:
    ACK 420e8c043e
  apoelstra:
    ACK 420e8c043e34817fa51939c0484ed77cb972ad46; successfully ran local tests; sure, this is reasonable enough

Tree-SHA512: 7a3834b9ac8a6c4742405d67e7a5d5b4eecdb6ec262d7525ba9538201c84fd4aef1a900c43a7dfc041cc09741dfc6fa34e7664ae371b66e9554718af0a85083b
This commit is contained in:
merge-script 2025-01-24 03:55:24 +00:00
commit 94b40902d4
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 9 additions and 0 deletions

View File

@ -1230,3 +1230,12 @@ fn signed_sub_assign() {
f -= &ssat(2);
assert_eq!(f, ssat(1));
}
#[test]
fn check_const() {
assert_eq!(SignedAmount::ONE_BTC.to_sat(), 100_000_000);
assert_eq!(Amount::ONE_BTC.to_sat(), 100_000_000);
assert_eq!(SignedAmount::FIFTY_BTC.to_sat(), SignedAmount::ONE_BTC.to_sat() * 50);
assert_eq!(Amount::FIFTY_BTC.to_sat(), Amount::ONE_BTC.to_sat() * 50);
assert_eq!(Amount::MAX_MONEY.to_sat() as i64, SignedAmount::MAX_MONEY.to_sat());
}