Skip to content

Commit

Permalink
greq/msg/tests: use unwrap() instead of asserting is_ok()
Browse files Browse the repository at this point in the history
This will show the causing error on failure.

Signed-off-by: Carlos López <carlos.lopez@suse.com>
  • Loading branch information
00xc committed Nov 23, 2023
1 parent 60cdfbe commit dd610f5
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/greq/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,27 +604,25 @@ mod tests {
let vmpck0 = [5u8; VMPCK_SIZE];
let vmpck0_seqno: u64 = 1;

let result = msg.encrypt_set(
msg.encrypt_set(
SnpGuestRequestMsgType::ReportRequest,
vmpck0_seqno,
&vmpck0,
PLAINTEXT,
);

assert!(result.is_ok());
)
.unwrap();

let mut outbuf = [0u8; PLAINTEXT.len()];

let result = msg.decrypt_get(
SnpGuestRequestMsgType::ReportRequest,
vmpck0_seqno,
&vmpck0,
&mut outbuf,
);

assert!(result.is_ok());
let outbuf_len = msg
.decrypt_get(
SnpGuestRequestMsgType::ReportRequest,
vmpck0_seqno,
&vmpck0,
&mut outbuf,
)
.unwrap();

let outbuf_len = result.unwrap();
assert_eq!(outbuf_len, PLAINTEXT.len());

assert_eq!(outbuf, PLAINTEXT);
Expand Down

0 comments on commit dd610f5

Please sign in to comment.