Skip to content

Commit

Permalink
Fix tests to use new error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Camerooooon committed Feb 23, 2024
1 parent 8435ce2 commit 3eb429b
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/system.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use cached::proc_macro::once;
use std::fs::{self, read_dir};
use std::path::Path;
use std::string::String;
Expand Down Expand Up @@ -520,9 +519,9 @@ microcode : 0xea

#[test]
fn list_cpus_acs_test() {
assert_eq!(type_of(list_cpus()), type_of(Vec::<CPU>::new()));
assert_eq!(type_of(list_cpus().unwrap()), type_of(Vec::<CPU>::new()));

for x in list_cpus() {
for x in list_cpus().unwrap() {
assert!(!x.name.is_empty());
assert!(x.max_freq > 0);
assert!(x.min_freq > 0);
Expand All @@ -537,9 +536,9 @@ microcode : 0xea
#[test]
fn list_cpu_speeds_acs_test() -> Result<(), Error> {
// Type check
assert_eq!(type_of(list_cpu_speeds()), type_of(Vec::<i32>::new()));
assert_eq!(type_of(list_cpu_speeds().unwrap()), type_of(Vec::<i32>::new()));

for x in list_cpu_speeds() {
for x in list_cpu_speeds().unwrap() {
assert!(x > 0);
}
Ok(())
Expand All @@ -548,19 +547,19 @@ microcode : 0xea
#[test]
fn list_cpu_temp_acs_test() {
// Type check
assert_eq!(type_of(list_cpu_temp()), type_of(Vec::<i32>::new()));
assert_eq!(type_of(list_cpu_temp().unwrap()), type_of(Vec::<i32>::new()));

for x in list_cpu_temp() {
for x in list_cpu_temp().unwrap() {
assert!(x > -100);
}
}

#[test]
fn list_cpu_governors_acs_test() {
// Type check
assert_eq!(type_of(list_cpu_governors()), type_of(Vec::<String>::new()));
assert_eq!(type_of(list_cpu_governors().unwrap()), type_of(Vec::<String>::new()));

for x in list_cpu_governors() {
for x in list_cpu_governors().unwrap() {
assert!(x == "powersave" || x == "performance" || x == "schedutil");
}
}
Expand Down

0 comments on commit 3eb429b

Please sign in to comment.