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

Function insert_many

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

Source from the content-addressed store, hash-verified

1332
1333 #[test]
1334 fn insert_many() {
1335 let f = &mut MapForest::<u32, f32>::new();
1336 let mut m = Map::<u32, f32>::new();
1337
1338 let mm = 4096;
1339 let mut x = 0;
1340
1341 for n in 0..mm {
1342 assert_eq!(m.insert(x, n as f32, f, &()), None);
1343 m.verify(f, &());
1344
1345 x = (x + n + 1) % mm;
1346 }
1347
1348 x = 0;
1349 for n in 0..mm {
1350 assert_eq!(m.get(x, f, &()), Some(n as f32));
1351 x = (x + n + 1) % mm;
1352 }
1353
1354 x = 0;
1355 for n in 0..mm {
1356 assert_eq!(m.remove(x, f, &()), Some(n as f32));
1357 m.verify(f, &());
1358
1359 x = (x + n + 1) % mm;
1360 }
1361
1362 assert!(m.is_empty());
1363 }
1364
1365 #[test]
1366 fn immutable_cursor() {

Callers

nothing calls this directly

Calls 2

newFunction · 0.50
verifyMethod · 0.45

Tested by

no test coverage detected