MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / remove_level1_rightmost

Function remove_level1_rightmost

cranelift/bforest/src/map.rs:1270–1289  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1268
1269 #[test]
1270 fn remove_level1_rightmost() {
1271 let f = &mut MapForest::<u32, f32>::new();
1272 let mut m = two_leaf(f);
1273
1274 // [ 10 20 30 40 ] [ 50 60 70 80 ]
1275
1276 // Remove entries from the right leaf. This doesn't trigger a rebalancing.
1277 assert_eq!(m.remove(60, f, &()), Some(6.0));
1278 assert_eq!(m.remove(80, f, &()), Some(8.0));
1279 assert_eq!(m.remove(50, f, &()), Some(5.0));
1280 m.verify(f, &());
1281
1282 // [ 10 20 30 40 ] [ 70 ]
1283 assert_eq!(m.tpath(50, f, &()), "node2[0]--node0[4]");
1284 assert_eq!(m.tpath(70, f, &()), "node2[1]--node1[0]");
1285
1286 // Removing the last entry from the right leaf should cause a collapse.
1287 assert_eq!(m.remove(70, f, &()), Some(7.0));
1288 m.verify(f, &());
1289 }
1290
1291 // Make a 3-level tree with barely healthy nodes.
1292 // 1 root, 8 inner nodes, 7*4+5=33 leaf nodes, 4 entries each.

Callers

nothing calls this directly

Calls 3

two_leafFunction · 0.85
newFunction · 0.50
verifyMethod · 0.45

Tested by

no test coverage detected