MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / wrapping_behavior

Function wrapping_behavior

nodedb-bridge/src/buffer.rs:426–438  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

424
425 #[test]
426 fn wrapping_behavior() {
427 // Verify the ring buffer works correctly when counters wrap past capacity.
428 let (mut tx, mut rx) = RingBuffer::channel::<u64>(4);
429
430 for round in 0..1000u64 {
431 for i in 0..4 {
432 tx.try_push(round * 4 + i).unwrap();
433 }
434 for i in 0..4 {
435 assert_eq!(rx.try_pop().unwrap(), round * 4 + i);
436 }
437 }
438 }
439
440 #[test]
441 fn metrics_counting() {

Callers

nothing calls this directly

Calls 1

try_pushMethod · 0.80

Tested by

no test coverage detected