pub mod cores;
pub mod file_list;
pub mod file_size;
pub mod file_status;
pub use cores::count_cores;
pub use file_status::{is_directory, is_reg_file, set_file_stat};
#[cfg(unix)]
pub use file_status::is_reg_fd;
pub use file_size::{get_file_size, get_open_file_size, get_total_file_size};
pub use file_list::create_file_list;
pub fn same_string(a: &str, b: &str) -> bool {
a == b
}
pub fn sleep_secs(secs: u64) {
std::thread::sleep(std::time::Duration::from_secs(secs));
}
pub fn sleep_millis(millis: u64) {
std::thread::sleep(std::time::Duration::from_millis(millis));
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn same_string_equal_strings() {
assert!(same_string("hello", "hello"));
}
#[test]
fn same_string_unequal_strings() {
assert!(!same_string("hello", "world"));
}
#[test]
fn same_string_empty_strings() {
assert!(same_string("", ""));
}
#[test]
fn same_string_one_empty() {
assert!(!same_string("a", ""));
assert!(!same_string("", "b"));
}
#[test]
fn count_cores_at_least_one() {
assert!(count_cores() >= 1);
}
}