From 420e8c043e34817fa51939c0484ed77cb972ad46 Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Thu, 23 Jan 2025 12:14:16 +0000 Subject: [PATCH] Fix mutants in units Cargo mutant found missed mutants in the bitcoin consts in both signed and unsigned amounts. Add a test to check their values. --- units/src/amount/tests.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/units/src/amount/tests.rs b/units/src/amount/tests.rs index 94b9a5462..1404ae108 100644 --- a/units/src/amount/tests.rs +++ b/units/src/amount/tests.rs @@ -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()); +}