-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Here I'd recommend to test not only the output length but also its content (by checking that the result is identical to the expected one):
Lines 62 to 76 in b168f70
| #[cfg(test)] | |
| mod generating_pseudorandom_bytes { | |
| use super::*; | |
| // TODO: 10,000 is the wrong number, @aniap what is correct here? | |
| #[test] | |
| fn it_generates_output_of_size_10000() { | |
| let key: [u8; STREAM_CIPHER_KEY_SIZE] = | |
| [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; | |
| let iv: [u8; STREAM_CIPHER_KEY_SIZE] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; | |
| let rand_bytes = generate_pseudorandom_bytes(&key, &iv, 10000); | |
| assert_eq!(10000, rand_bytes.len()); | |
| } | |
| } |
Also, it's usually better to use input values other than all-zero (or all-some-constant) to detect potential endianness and byte ordering issues.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels