-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch proofs from
any_vec
to slices
- Loading branch information
1 parent
b7eb10c
commit b80b788
Showing
8 changed files
with
807 additions
and
629 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,37 @@ | ||
use super::*; | ||
|
||
const CHECKSUM_INPUT_LENGTH: usize = 64; | ||
|
||
#[kani::proof] | ||
fn finalize_checksum_proof() { | ||
finalize_checksum(kani::any()); | ||
} | ||
|
||
#[kani::proof] | ||
fn internet_checksum_up_to_64_bytes_proof() { | ||
let vec = kani::vec::any_vec::<u8, 64>(); | ||
let slice = vec.as_slice(); | ||
internet_checksum_up_to_64_bytes(slice); | ||
let mut any_array: [u8; CHECKSUM_INPUT_LENGTH] = kani::any(); | ||
let any_slice_length = kani::any_where(|i| *i <= CHECKSUM_INPUT_LENGTH); | ||
let any_slice = &mut any_array[..any_slice_length]; | ||
|
||
internet_checksum_up_to_64_bytes(any_slice); | ||
} | ||
|
||
#[kani::proof] | ||
#[kani::unwind(20)] | ||
fn internet_checksum_intermediary_proof() { | ||
let vec = kani::vec::any_vec::<u8, 64>(); | ||
let slice = vec.as_slice(); | ||
internet_checksum_intermediary::<4>(slice); | ||
let mut any_array: [u8; CHECKSUM_INPUT_LENGTH] = kani::any(); | ||
let any_slice_length = kani::any_where(|i| *i <= CHECKSUM_INPUT_LENGTH); | ||
let any_slice = &mut any_array[..any_slice_length]; | ||
|
||
internet_checksum_intermediary::<4>(any_slice); | ||
} | ||
|
||
#[kani::proof] | ||
#[kani::unwind(20)] | ||
fn internet_checksum_variable_chunks_proof() { | ||
let vec = kani::vec::any_vec::<u8, 64>(); | ||
let slice = vec.as_slice(); | ||
internet_checksum::<4>(0, slice); | ||
let mut any_array: [u8; CHECKSUM_INPUT_LENGTH] = kani::any(); | ||
let any_slice_length = kani::any_where(|i| *i <= CHECKSUM_INPUT_LENGTH); | ||
let any_slice = &mut any_array[..any_slice_length]; | ||
|
||
internet_checksum::<4>(0, any_slice); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.