From a48057eac3734041666891aef0a22ecae1b082da Mon Sep 17 00:00:00 2001 From: Rostyslav Tyshko Date: Fri, 2 May 2025 17:27:07 -0400 Subject: [PATCH] test_write_append_and_read added --- sc_core/src/private_state.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sc_core/src/private_state.rs b/sc_core/src/private_state.rs index aeff6393..51b31e73 100644 --- a/sc_core/src/private_state.rs +++ b/sc_core/src/private_state.rs @@ -275,4 +275,16 @@ mod tests { assert_eq!(max_slot(&state), 5); } + #[test] + fn test_write_append_and_read() { + let mut state = PrivateSCState::new(); + let data = vec![1u8; PRIVATE_BLOB_SIZE * 2 + 10]; + + let last_slot = write_num_bytes_append(&mut state, data.clone()).unwrap(); + assert_eq!(last_slot, 3); + + let read = read_num_bytes_start(&state, last_slot).unwrap(); + assert_eq!(read.len(), 0); + } + }