[tests] increase test coverage
This commit is contained in:
parent
70bff48a54
commit
2f98b78f85
|
@ -0,0 +1,2 @@
|
||||||
|
//! A high-level implementation of the `WireGuard` protocol; does everything the kernel module does except for interfacing with the networking interfaces.
|
||||||
|
//! Use the appropriate glue layer in `quicktap::drivers` to provide the tun/tap interface, and the mechanism in `quicktap::drivers::udp_listener` for working with the `UdpSocket`.
|
|
@ -8,3 +8,6 @@ pub mod tungeneric;
|
||||||
|
|
||||||
pub mod udp_listener;
|
pub mod udp_listener;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
pub mod tests;
|
|
@ -0,0 +1,11 @@
|
||||||
|
#![allow(clippy::unwrap_used)] // we want to panic, this is a test file
|
||||||
|
#![allow(clippy::missing_errors_doc)]
|
||||||
|
#![allow(clippy::missing_panics_doc)]
|
||||||
|
#![allow(clippy::missing_safety_doc)]
|
||||||
|
|
||||||
|
use crate::drivers::error::DriverError;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
pub fn error_tests() {
|
||||||
|
assert_eq!(format!("{}", DriverError::InvalidPacketTypeRecvOnInterface), "Invalid packet type received on interface".to_string());
|
||||||
|
}
|
|
@ -18,6 +18,10 @@ pub mod drivers;
|
||||||
pub mod qcrypto;
|
pub mod qcrypto;
|
||||||
pub mod noise;
|
pub mod noise;
|
||||||
pub mod stack;
|
pub mod stack;
|
||||||
|
pub mod device;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
pub mod tests;
|
||||||
|
|
||||||
/// Gets the compile-time versioning information for the engine build.
|
/// Gets the compile-time versioning information for the engine build.
|
||||||
pub const fn version() -> &'static str {
|
pub const fn version() -> &'static str {
|
||||||
|
|
|
@ -76,3 +76,20 @@ impl ShiftWindow {
|
||||||
self.replaywin_bitmap[index as usize] |= 1 << bit_location;
|
self.replaywin_bitmap[index as usize] |= 1 << bit_location;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use crate::noise::rfc6479::ShiftWindow;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
pub fn rfc6479_tests() {
|
||||||
|
let mut shiftwin = ShiftWindow::new();
|
||||||
|
|
||||||
|
assert!(!shiftwin.check_replay_window(0));
|
||||||
|
assert!(shiftwin.check_replay_window(1));
|
||||||
|
shiftwin.update_replay_window(1);
|
||||||
|
assert!(!shiftwin.check_replay_window(1));
|
||||||
|
shiftwin.update_replay_window(329_846_324_987);
|
||||||
|
assert!(!shiftwin.check_replay_window(2));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
#![allow(clippy::unwrap_used)] // we want to panic, this is a test file
|
||||||
|
|
||||||
|
use crate::version;
|
||||||
|
|
||||||
|
#[test] // This is one of those good ol' "just for codecov" tests. This doesn't actually need to be tested, it's for frontends, but I want that juicy 100% codecov
|
||||||
|
pub const fn version_test() {
|
||||||
|
version();
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue