Skip to content

Commit 9eeccb2

Browse files
committed
f - another quantity_max parsing test case
1 parent 5add3d6 commit 9eeccb2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lightning/src/offers/offer.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,19 @@ mod tests {
957957
if let Err(e) = offer.to_string().parse::<Offer>() {
958958
panic!("error parsing offer: {:?}", e);
959959
}
960+
961+
let mut tlv_stream = offer.as_tlv_stream();
962+
tlv_stream.quantity_max = Some(1);
963+
964+
let mut encoded_offer = Vec::new();
965+
tlv_stream.write(&mut encoded_offer).unwrap();
966+
967+
match Offer::try_from(encoded_offer) {
968+
Ok(_) => panic!("expected error"),
969+
Err(e) => {
970+
assert_eq!(e, ParseError::InvalidSemantics(SemanticError::InvalidQuantity));
971+
},
972+
}
960973
}
961974

962975
#[test]

0 commit comments

Comments
 (0)