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

Source from the content-addressed store, hash-verified

374
375 #[test]
376 fn test_view_state_invalid_kind() {
377 // Build valid v2 bytes but with an invalid kind byte
378 let mut bytes = Vec::new();
379 bytes.extend_from_slice(&1u64.to_le_bytes()); // id
380 let name = "test";
381 bytes.extend_from_slice(&(name.len() as u32).to_le_bytes());
382 bytes.extend_from_slice(name.as_bytes());
383 bytes.extend_from_slice(&[0u8; 32]); // merkle
384 bytes.extend_from_slice(&0u64.to_le_bytes()); // change_count
385 bytes.push(99); // invalid kind
386 bytes.extend_from_slice(&u64::MAX.to_le_bytes()); // parent (none)
387
388 let result = deserialize_view_state(&bytes);
389 assert!(result.is_err());
390 }
391
392 #[test]
393 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