Move tests into a separate directory

Also run these tests on Github Actions as part of the PR request
flow.
This commit is contained in:
Sam Poder 2023-06-29 18:18:55 +00:00 committed by Conrad Kramer
parent a2e93278c1
commit 86b53c9dcd
6 changed files with 68 additions and 95 deletions

View file

@ -156,32 +156,3 @@ impl TunInterface {
.map_err(|_| Error::new(ErrorKind::Other, "Conversion error"))?
}
}
#[cfg(test)]
mod test {
use super::*;
use std::net::Ipv4Addr;
#[test]
fn mtu() {
let interf = TunInterface::new().unwrap();
interf.set_mtu(500).unwrap();
assert_eq!(interf.mtu().unwrap(), 500);
}
#[test]
#[throws]
fn netmask() {
let interf = TunInterface::new()?;
let netmask = Ipv4Addr::new(255, 0, 0, 0);
let addr = Ipv4Addr::new(192, 168, 1, 1);
interf.set_ipv4_addr(addr)?;
interf.set_netmask(netmask)?;
assert_eq!(interf.netmask()?, netmask);
}
}