use pert::pert; use rand::Rng; #[test] fn test_task_init() { let task: pert::Task = pert::Task::new(1, 0, 2, 0); assert_eq!(task.id, 1); assert_eq!(task.duration, 2); } #[test] fn test_task_duration() { let duration: u32 = rand::thread_rng().gen_range(1..10); let task: pert::Task = pert::Task::new(1, 0, duration, 0); assert_eq!(task.id, 1); assert_eq!(task.duration, duration); } #[test] fn test_task_default() { let task: pert::Task = pert::Task::new(1, 0, 2, 0); assert_eq!(task.id, 1); assert_eq!(task.duration, 2); assert_eq!(task.parent, 0); } #[test] fn test_link_init() { let link: pert::Link = pert::Link::new(1, 2); assert_eq!(link.source, 1); assert_eq!(link.target, 2); } #[test] fn test_link_from_tasks() { let task_1: pert::Task = pert::Task::new(1, 0, 2, 0); let task_2: pert::Task = pert::Task::new(2, 0, 7, 0); let link: pert::Link = pert::Link::new(task_1.id, task_2.id); assert_eq!(link.source, task_1.id); assert_eq!(link.target, task_2.id); }