diff --git a/units/src/amount/mod.rs b/units/src/amount/mod.rs index 1980a8c54..b290c625f 100644 --- a/units/src/amount/mod.rs +++ b/units/src/amount/mod.rs @@ -58,12 +58,20 @@ pub use self::{ /// ``` /// # use bitcoin_units::Amount; /// -/// assert_eq!("1 BTC".parse::().unwrap(), Amount::from_sat(100_000_000)); -/// assert_eq!("1 cBTC".parse::().unwrap(), Amount::from_sat(1_000_000)); -/// assert_eq!("1 mBTC".parse::().unwrap(), Amount::from_sat(100_000)); -/// assert_eq!("1 uBTC".parse::().unwrap(), Amount::from_sat(100)); -/// assert_eq!("1 bit".parse::().unwrap(), Amount::from_sat(100)); -/// assert_eq!("1 sat".parse::().unwrap(), Amount::from_sat(1)); +/// let equal = [ +/// ("1 BTC", 100_000_000), +/// ("1 cBTC", 1_000_000), +/// ("1 mBTC", 100_000), +/// ("1 uBTC", 100), +/// ("1 bit", 100), +/// ("1 sat", 1), +/// ]; +/// for (string, sats) in equal { +/// assert_eq!( +/// string.parse::().expect("valid bitcoin amount string"), +/// Amount::from_sat(sats), +/// ) +/// } /// ``` #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] #[non_exhaustive]