Skip to content

Commit

Permalink
Rework dict iterators
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexagon committed Aug 11, 2023
1 parent c01b437 commit 691b272
Show file tree
Hide file tree
Showing 2 changed files with 309 additions and 97 deletions.
18 changes: 18 additions & 0 deletions src/cell/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,24 @@ mod tests {
builder.rewind(27).unwrap();
assert_eq!(builder.bit_len(), 0);
assert_eq!(builder.data, [0u8; 128]);

builder.store_raw(&[0xff; 128], MAX_BIT_LEN).unwrap();
assert_eq!(builder.bit_len(), MAX_BIT_LEN);

let mut target = [0xff; 128];
target[127] = 0xfe;
assert_eq!(builder.data, target);

builder.rewind(3).unwrap();
assert_eq!(builder.bit_len(), MAX_BIT_LEN - 3);
target[127] = 0xf0;
assert_eq!(builder.data, target);

builder.rewind(8).unwrap();
assert_eq!(builder.bit_len(), MAX_BIT_LEN - 3 - 8);
target[126] = 0xf0;
target[127] = 0x00;
assert_eq!(builder.data, target);
}

#[test]
Expand Down
Loading

0 comments on commit 691b272

Please sign in to comment.