byte_array_ops/security/
mod.rs1pub mod constant_time;
4pub mod display;
5pub mod vec;
6pub mod zeroize;
7
8#[cfg(test)]
9mod security_tests {
10 use super::super::*;
11
12 #[test]
13 fn test_extend_no_reallocate() {
14 let other_bytes = bytes![0xff;200000];
15 let bytes = bytes![0xff;1000000];
16 let bytes_res = bytes.try_extend(other_bytes);
17 assert!(bytes_res.is_ok()); let bytes = bytes_res.unwrap();
19
20 assert_eq!(bytes.bytes.capacity(), 1200010);
21 }
22
23 #[test]
24 fn test_extend_no_reallocate_large_cap() {
25 let other_bytes = ByteArray::with_capacity(1024);
26 let bytes = bytes![0xff;1000000];
27 let bytes_res = bytes.try_extend_with_preserve_cap(other_bytes);
28 assert!(bytes_res.is_ok()); let bytes = bytes_res.unwrap();
31 assert_eq!(bytes.bytes.capacity(), 1001034);
32 assert_eq!(bytes.bytes.len(), 1000000);
33 }
34}