Run tests on Github Actions
This commit is contained in:
parent
1907b11545
commit
17af030893
6 changed files with 38 additions and 44 deletions
|
|
@ -32,27 +32,3 @@ impl TunInterface {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::net::Ipv4Addr;
|
||||
|
||||
use super::*;
|
||||
#[tokio::test]
|
||||
async fn test_create() {
|
||||
let tun = crate::TunInterface::new().unwrap();
|
||||
let _async_tun = TunInterface::new(tun).unwrap();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_write() {
|
||||
let tun = crate::TunInterface::new().unwrap();
|
||||
tun.set_ipv4_addr(Ipv4Addr::from([192, 168, 1, 10]))
|
||||
.unwrap();
|
||||
let async_tun = TunInterface::new(tun).unwrap();
|
||||
let mut buf = [0u8; 1500];
|
||||
buf[0] = 6 << 4;
|
||||
let bytes_written = async_tun.write(&buf).await.unwrap();
|
||||
assert!(bytes_written > 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue