Skip to content

Commit

Permalink
fix[hacspec]: invalid traces plaintext_2
Browse files Browse the repository at this point in the history
  • Loading branch information
geonnave committed Sep 14, 2023
1 parent e31c578 commit 7ca2a4b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions hacspec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1913,6 +1913,27 @@ mod tests {
assert_bytes_eq!(plaintext_2.content, plaintext_2_tv.content);
}

#[test]
fn test_parse_plaintext_2_invalid_traces() {
let plaintext_2_tv_len = PLAINTEXT_2_SURPLUS_MAP_ID_CRED_TV.len() / 2;
let plaintext_2_tv = BytesMaxBuffer::from_slice(
&ByteSeq::from_hex(PLAINTEXT_2_SURPLUS_MAP_ID_CRED_TV),
0,
plaintext_2_tv_len,
);
let plaintext_2 = decode_plaintext_2(&plaintext_2_tv, plaintext_2_tv_len);
assert!(plaintext_2.is_err());

let plaintext_2_tv_len = PLAINTEXT_2_SURPLUS_BSTR_ID_CRED_TV.len() / 2;
let plaintext_2_tv = BytesMaxBuffer::from_slice(
&ByteSeq::from_hex(PLAINTEXT_2_SURPLUS_BSTR_ID_CRED_TV),
0,
plaintext_2_tv_len,
);
let plaintext_2 = decode_plaintext_2(&plaintext_2_tv, plaintext_2_tv_len);
assert!(plaintext_2.is_err());
}

#[test]
fn test_decode_plaintext_2() {
let plaintext_2_tv = BytesMaxBuffer::from_slice(
Expand Down

0 comments on commit 7ca2a4b

Please sign in to comment.