Insert a HAMT into the block store of an agent.
(agent: &mut Agent)
| 388 | |
| 389 | /// Insert a HAMT into the block store of an agent. |
| 390 | fn insert_test_data(agent: &mut Agent) -> anyhow::Result<Cid> { |
| 391 | let mut hamt: Hamt<_, String, u32> = Hamt::new_with_bit_width(&agent.store, BIT_WIDTH); |
| 392 | |
| 393 | // Insert enough data into the HAMT to make sure it grows from a single `Node`. |
| 394 | for i in 0..KEY_COUNT { |
| 395 | hamt.set(i, format!("value {i}"))?; |
| 396 | } |
| 397 | let cid = hamt.flush()?; |
| 398 | |
| 399 | Ok(cid) |
| 400 | } |
| 401 | |
| 402 | fn check_test_data(agent: &mut Agent, cid: &Cid) -> anyhow::Result<()> { |
| 403 | let hamt: Hamt<_, String, u32> = Hamt::load_with_bit_width(cid, &agent.store, BIT_WIDTH)?; |
no test coverage detected