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