Add sub-sat fractions parsing regression test

This test triggers the bug fixed in previous commit.
This commit is contained in:
Martin Habovstiak 2023-05-07 08:47:53 +02:00
parent f1a3dc6719
commit 6c6a89b1d1
1 changed files with 2 additions and 0 deletions

View File

@ -1684,6 +1684,8 @@ mod tests {
p("12345678901.12345678", btc), p("12345678901.12345678", btc),
Ok(Amount::from_sat(12_345_678_901__123_456_78)) Ok(Amount::from_sat(12_345_678_901__123_456_78))
); );
assert_eq!(p("1000.0", msat), Ok(Amount::from_sat(1)));
assert_eq!(p("1000.000000000000000000000000000", msat), Ok(Amount::from_sat(1)));
// make sure satoshi > i64::max_value() is checked. // make sure satoshi > i64::max_value() is checked.
let amount = Amount::from_sat(i64::max_value() as u64); let amount = Amount::from_sat(i64::max_value() as u64);