Skip to content

Commit

Permalink
byte-reader pub
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetbout committed Apr 12, 2024
1 parent 5ea7de1 commit 2f3fb25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/data_structures/src/byte_reader.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use super::bit_array::{one_shift_left_bytes_felt252, one_shift_left_bytes_u128};

#[derive(Copy, Clone, Drop)]
pub struct ByteReaderState<T> {
pub data: @T,
pub index: usize,
pub(crate) data: @T,
index: usize,
}

pub trait ByteReader<T> {
Expand Down
8 changes: 4 additions & 4 deletions src/data_structures/src/tests/byte_reader_test.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,9 @@ fn test_clone_byte_array_reader() {
let mut rd1 = ba.reader();
let mut rd2 = rd1.clone();
let a = rd1.read_u128().unwrap();
assert!(rd1.index != rd2.index, "indicies equal");
assert!(rd1.len() != rd2.len(), "indices equal");
let b = rd2.read_u128().unwrap();
assert!(rd1.index == rd2.index, "indicies not equal");
assert!(rd1.len() == rd2.len(), "indices not equal");
assert!(a == b, "copy ByteArrayReader failed");
}

Expand All @@ -481,9 +481,9 @@ fn test_clone_array_of_bytes_reader() {
let mut rd1 = ba.reader();
let mut rd2 = rd1.clone();
let a = rd1.read_u128().unwrap();
assert!(rd1.index != rd2.index, "indicies equal");
assert!(rd1.len() != rd2.len(), "indices equal");
let b = rd2.read_u128().unwrap();
assert!(rd1.index == rd2.index, "indicies not equal");
assert!(rd1.len() == rd2.len(), "indices not equal");
assert!(a == b, "copy ByteArrayReader failed");
}

Expand Down

0 comments on commit 2f3fb25

Please sign in to comment.