Skip to content

Commit

Permalink
Try to add test
Browse files Browse the repository at this point in the history
  • Loading branch information
frack113 committed Dec 8, 2024
1 parent 5864131 commit bf236d1
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/traces/drivers/byovd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,18 @@ impl Runnable for Byovd {
}
}
}


#[cfg(test)]
mod tests {
use std::path::PathBuf;
use crate::traces::drivers::Byovd;
use crate::traces::Runnable;

#[test]
fn test_byovd() {
let byovd: Byovd = Byovd{ service_name: "test".to_string(), displayed_name: "test".to_string(), path: PathBuf::from(r"driver.dll") };
let test_ret: bool = byovd.run().is_ok();
assert_eq!(test_ret,true);
}
}
16 changes: 16 additions & 0 deletions src/traces/processes/spoofing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,19 @@ impl Runnable for Spoofing {
Ok(())
}
}


#[cfg(test)]
mod tests {
use std::path::PathBuf;
use crate::traces::Runnable;
use crate::traces::processes::Spoofing;


#[test]
fn test_simple_spoofing() {
let spoofing: Spoofing = Spoofing{ executable:PathBuf::from(r"C:\Windows\System32\calc.exe"), parent_executable:"cargo.exe".to_string()};
let test_ret: bool = spoofing.run().is_ok();
assert_eq!(test_ret,true);
}
}
1 change: 1 addition & 0 deletions src/windows/processes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ pub fn get_pid(name: &str) -> Result<u32, Box<dyn Error>> {

Err(Box::new(ProcessNotFound))
}

12 changes: 12 additions & 0 deletions src/windows/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,15 @@ pub fn is_administrator() -> WindowsResult<bool> {

Ok(is_admin.as_bool())
}



#[cfg(test)]
mod tests {
use crate::windows::users::is_administrator;
#[test]
fn not_admin() {
let result = is_administrator();
assert_eq!(result, Ok(false));
}
}

0 comments on commit bf236d1

Please sign in to comment.