Skip to content

Commit 2d07fe6

Browse files
committed
Added encoding and decoding with padding
1 parent 19ad8bc commit 2d07fe6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/padding.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ fn test_from_bytes_padded_multiple_blocks() {
5656
assert_eq!(expected_blocks, result.len());
5757

5858
// Check the content of each full block
59-
for i in 0..(data.len() / 16) {
59+
for (i, block) in result.iter().enumerate().take(data.len() / 16) {
6060
let start = i * 16;
61-
let expected = &data[start..start + 16];
62-
assert_eq!(expected, &result[i].as_bytes().unwrap()[..16]);
61+
let expected = data[start..start + 16].to_vec();
62+
assert_eq!(expected, block.as_bytes().unwrap()[..16]);
6363
}
6464

6565
// Check the last block's padding
@@ -71,8 +71,8 @@ fn test_from_bytes_padded_multiple_blocks() {
7171
assert_eq!(&data[data.len() - remaining..], &last_block[..remaining]);
7272

7373
// Verify padding portion
74-
for i in remaining..16 {
75-
assert_eq!(padding_byte, last_block[i]);
74+
for byte in last_block.iter().skip(remaining) {
75+
assert_eq!(&padding_byte, byte);
7676
}
7777
}
7878

0 commit comments

Comments
 (0)