MCPcopy Create free account
hub / github.com/base/base / insert_and_drain

Function insert_and_drain

crates/execution/flashblocks/src/cache.rs:117–131  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

115
116 #[test]
117 fn insert_and_drain() {
118 let mut cache = FlashblockCache::new(10);
119
120 assert!(cache.insert(make_flashblock(11, 1)));
121 assert!(cache.insert(make_flashblock(11, 0)));
122 assert_eq!(cache.len(), 1);
123 assert_eq!(cache.total_flashblocks(), 2);
124
125 let drained = cache.drain(11);
126 assert_eq!(drained.len(), 2);
127 // Should be sorted by index
128 assert_eq!(drained[0].index, 0);
129 assert_eq!(drained[1].index, 1);
130 assert!(cache.is_empty());
131 }
132
133 #[test]
134 fn drain_empty() {

Callers

nothing calls this directly

Calls 1

drainMethod · 0.45

Tested by

no test coverage detected