MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_amount_all_any

Function test_amount_all_any

cln-rpc/src/primitives.rs:831–857  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

829
830 #[test]
831 fn test_amount_all_any() {
832 let t = r#"{"any": "any", "all": "all", "not_any": "42msat", "not_all": "31337msat"}"#;
833
834 #[derive(Serialize, Deserialize, Debug, PartialEq)]
835 struct T {
836 all: AmountOrAll,
837 not_all: AmountOrAll,
838 any: AmountOrAny,
839 not_any: AmountOrAny,
840 }
841
842 let parsed: T = serde_json::from_str(t).unwrap();
843
844 let expected = T {
845 all: AmountOrAll::All,
846 any: AmountOrAny::Any,
847 not_all: AmountOrAll::Amount(Amount { msat: 31337 }),
848 not_any: AmountOrAny::Amount(Amount { msat: 42 }),
849 };
850 assert_eq!(expected, parsed);
851
852 let serialized: String = serde_json::to_string(&parsed).unwrap();
853 assert_eq!(
854 serialized,
855 r#"{"all":"all","not_all":"31337msat","any":"any","not_any":"42msat"}"#
856 );
857 }
858
859 #[test]
860 fn test_parse_feerate() {

Callers

nothing calls this directly

Calls 3

AmountClass · 0.85
to_stringFunction · 0.50
unwrapMethod · 0.45

Tested by

no test coverage detected