extern crate cgroups;
use cgroups::{Cgroup, CgroupPid};
extern crate libc;
extern crate nix;
#[test]
fn test_tasks_iterator() {
let hier = cgroups::hierarchies::V1::new();
let pid = libc::pid_t::from(nix::unistd::getpid()) as u64;
let cg = Cgroup::new(&hier, String::from("test_tasks_iterator"));
{
cg.add_task(CgroupPid::from(pid));
let mut tasks = cg.tasks().into_iter();
assert_eq!(tasks.next(), Some(CgroupPid::from(pid)));
assert_eq!(tasks.next(), None);
cg.remove_task(CgroupPid::from(pid));
tasks = cg.tasks().into_iter();
assert_eq!(tasks.next(), None);
}
cg.delete();
}