Skip to content

Commit a1fcce7

Browse files
committed
Add unit tests for Display
1 parent 7561dce commit a1fcce7

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lightning/src/ln/channelmanager.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use bitcoin::blockdata::constants::{genesis_block, ChainHash};
2323
use bitcoin::network::constants::Network;
2424

2525
use bitcoin::hashes::Hash;
26-
use bitcoin::hashes::hex::ToHex;
2726
use bitcoin::hashes::sha256::Hash as Sha256;
2827
use bitcoin::hash_types::{BlockHash, Txid};
2928

@@ -10364,6 +10363,16 @@ mod tests {
1036410363
let events = nodes[0].node.get_and_clear_pending_msg_events();
1036510364
assert_eq!(events.len(), 0);
1036610365
}
10366+
10367+
#[test]
10368+
fn test_payment_display() {
10369+
let payment_id = PaymentId([42; 32]);
10370+
assert_eq!(format!("{}", &payment_id), "2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a");
10371+
let payment_hash = PaymentHash([42; 32]);
10372+
assert_eq!(format!("{}", &payment_hash), "2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a");
10373+
let payment_preimage = PaymentPreimage([42; 32]);
10374+
assert_eq!(format!("{}", &payment_preimage), "2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a");
10375+
}
1036710376
}
1036810377

1036910378
#[cfg(ldk_bench)]

lightning/src/routing/gossip.rs

+6
Original file line numberDiff line numberDiff line change
@@ -3418,6 +3418,12 @@ pub(crate) mod tests {
34183418
// This serialized info has an address field but no announcement_message, therefore the addresses returned by our function will still be empty
34193419
assert!(ann_info_with_addresses.addresses().is_empty());
34203420
}
3421+
3422+
#[test]
3423+
fn test_node_id_display() {
3424+
let node_id = NodeId([42; 33]);
3425+
assert_eq!(format!("{}", &node_id), "2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a");
3426+
}
34213427
}
34223428

34233429
#[cfg(ldk_bench)]

0 commit comments

Comments
 (0)