MCPcopy Create free account
hub / github.com/aws/clock-bound / push_and_peek

Function push_and_peek

clock-bound/src/daemon/clock_sync_algorithm/ring_buffer.rs:204–213  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

202
203 #[test]
204 fn push_and_peek() {
205 let mut buffer = RingBuffer::new(NonZeroUsize::new(3).unwrap());
206
207 buffer.push(1);
208 buffer.push(2);
209
210 assert_eq!(buffer.peek_at(0), Some(&1));
211 assert_eq!(buffer.peek_at(1), Some(&2));
212 assert_eq!(buffer.peek_at(2), None);
213 }
214
215 #[test]
216 fn buffer_overflow() {

Callers

nothing calls this directly

Calls 2

newFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected