MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_view_state_invalid_kind

Function test_view_state_invalid_kind

atomic-core/src/pristine/txn/helpers.rs:395–409  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

393
394 #[test]
395 fn test_view_state_invalid_kind() {
396 // Build valid v2 bytes but with an invalid kind byte
397 let mut bytes = Vec::new();
398 bytes.extend_from_slice(&1u64.to_le_bytes()); // id
399 let name = "test";
400 bytes.extend_from_slice(&(name.len() as u32).to_le_bytes());
401 bytes.extend_from_slice(name.as_bytes());
402 bytes.extend_from_slice(&[0u8; 32]); // merkle
403 bytes.extend_from_slice(&0u64.to_le_bytes()); // change_count
404 bytes.push(99); // invalid kind
405 bytes.extend_from_slice(&u64::MAX.to_le_bytes()); // parent (none)
406
407 let result = deserialize_view_state(&bytes);
408 assert!(result.is_err());
409 }
410
411 #[test]
412 fn test_adj_iterator() {

Callers

nothing calls this directly

Calls 5

deserialize_view_stateFunction · 0.85
to_le_bytesMethod · 0.80
lenMethod · 0.45
as_bytesMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected