MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / test_get_ping_offset

Function test_get_ping_offset

chirpstack/src/downlink/classb.rs:119–132  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

117
118 #[test]
119 fn test_get_ping_offset() {
120 for k in 0..8 {
121 let mut beacon_ts = Duration::zero();
122 let ping_nb: usize = 1 << k;
123 let ping_period = PING_PERIOD_BASE / ping_nb;
124 let dev_addr = DevAddr::from_be_bytes([0, 0, 0, 0]);
125
126 for _ in 0..100000 {
127 let offset = get_ping_offset(beacon_ts, &dev_addr, ping_nb).unwrap();
128 assert!(offset < ping_period);
129 beacon_ts += *BEACON_PERIOD;
130 }
131 }
132 }
133
134 #[test]
135 fn test_get_next_ping_slot_after() {

Callers

nothing calls this directly

Calls 2

get_ping_offsetFunction · 0.85
unwrapMethod · 0.80

Tested by

no test coverage detected