use tempfile::tempdir;
use crate::linux_io::{LinuxIo, LinuxIoConfig};
use super::*;
#[test]
fn test_linux_io_open_write_read() {
let mut io = LinuxIo::new(LinuxIoConfig::default()).unwrap();
let dir = tempdir().unwrap();
test_open_write_read(&mut io, &dir.path().join("test.txt"));
}
#[test]
fn test_linux_io_write_read_slice() {
let mut io = LinuxIo::new(LinuxIoConfig::default()).unwrap();
let dir = tempdir().unwrap();
test_write_read_slice(&mut io, &dir.path().join("test.txt"));
}
#[test]
fn test_linux_io_remove() {
let mut io = LinuxIo::new(LinuxIoConfig::default()).unwrap();
let dir = tempdir().unwrap();
test_remove(&mut io, &dir.path().join("test.txt"));
}
#[test]
fn test_linux_io_create_dir_and_file() {
let mut io = LinuxIo::new(LinuxIoConfig::default()).unwrap();
let dir = tempdir().unwrap();
let nested = dir.path().join("a").join("b").join("c");
let filepath = nested.join("deep_file.txt");
test_create_dir_and_file(&mut io, &nested, &filepath);
}
#[test]
fn test_linux_io_fstat() {
let mut io = LinuxIo::new(LinuxIoConfig::default()).unwrap();
let dir = tempdir().unwrap();
test_fstat(&mut io, &dir.path().join("test.txt"));
}
#[test]
fn test_linux_io_list_dir() {
let mut io = LinuxIo::new(LinuxIoConfig::default()).unwrap();
let dir = tempdir().unwrap();
test_list_dir(&mut io, &dir.path().join("listing"));
}
#[test]
fn test_linux_io_registered_buf_write_read() {
let mut io = LinuxIo::new(LinuxIoConfig::default()).unwrap();
let dir = tempdir().unwrap();
test_registered_buf_write_read(&mut io, &dir.path().join("reg_test.txt"));
}