ableos/ableos/src/scheduler/tests.rs

46 lines
1.2 KiB
Rust

use super::*;
use crate::{scheduler::{proc::PID, Priority::*, Scheduler}, capabilities::Ability};
// #[test]
fn test_new_process() {
let mut scheduler = Scheduler::new();
scheduler.new_process(High);
assert_eq!(scheduler.list.len(), 1);
}
// #[test]
fn test_next_process() {
let mut scheduler = Scheduler::new();
scheduler.new_process(High);
scheduler.next_process();
assert_eq!(scheduler.list.len(), 0);
}
// #[test]
fn test_term_process() {
let mut scheduler = Scheduler::new();
scheduler.new_process(High);
scheduler.term_process(PID(1));
assert_eq!(scheduler.list.len(), 0);
}
// #[test]
fn test_bump_exec() {
let mut scheduler = Scheduler::new();
scheduler.new_process(High);
scheduler.bump_exec();
assert_eq!(scheduler.process_exec_time, 1);
}
// #[test]
fn test_capabilities() {
let caps = Capabilities::empty();
assert!(!caps.has_ability(Ability::AllControllers));
assert!(!caps.has_ability(Ability::AllFiles));
assert!(!caps.has_ability(Ability::AllSoundCards));
assert!(!caps.has_ability(Ability::Keyboard));
assert!(!caps.has_ability(Ability::Mouse));
assert!(!caps.has_ability(Ability::Telecomms));
}