MCPcopy Create free account
hub / github.com/aleph-zero-foundation/AlephBFT / bool_node_map_decoding_works

Function bool_node_map_decoding_works

crypto/src/node.rs:321–336  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

319
320 #[test]
321 fn bool_node_map_decoding_works() {
322 for len in 0..12 {
323 for mask in 0..(1 << len) {
324 let mut bnm = NodeSubset::with_size(len.into());
325 for i in 0..len {
326 if (1 << i) & mask != 0 {
327 bnm.insert(i.into());
328 }
329 }
330 let encoded: Vec<_> = bnm.encode();
331 let decoded =
332 NodeSubset::decode(&mut encoded.as_slice()).expect("decode should work");
333 assert!(decoded == bnm);
334 }
335 }
336 }
337
338 #[test]
339 fn bool_node_map_decoding_deals_with_trailing_zeros() {

Callers

nothing calls this directly

Calls 2

intoMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected