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:471–485  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

469
470 #[test]
471 fn test_view_state_invalid_kind() {
472 // Build valid v2 bytes but with an invalid kind byte
473 let mut bytes = Vec::new();
474 bytes.extend_from_slice(&1u64.to_le_bytes()); // id
475 let name = "test";
476 bytes.extend_from_slice(&(name.len() as u32).to_le_bytes());
477 bytes.extend_from_slice(name.as_bytes());
478 bytes.extend_from_slice(&[0u8; 32]); // merkle
479 bytes.extend_from_slice(&0u64.to_le_bytes()); // change_count
480 bytes.push(99); // invalid kind
481 bytes.extend_from_slice(&u64::MAX.to_le_bytes()); // parent (none)
482
483 let result = deserialize_view_state(&bytes);
484 assert!(result.is_err());
485 }
486
487 #[test]
488 fn try_collect_rejects_partial_success() {

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