From b544616801b50ac4e643247678551aefe68a037d Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Wed, 14 Aug 2024 16:00:03 +0300 Subject: [PATCH] test(tasks): small rearrangements --- src/tasks.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/tasks.rs b/src/tasks.rs index b871d16..eb70139 100644 --- a/src/tasks.rs +++ b/src/tasks.rs @@ -1057,20 +1057,20 @@ mod tasks_test { tasks.make_task_and_enter("proc: tags", State::Procedure); let side = tasks.submit(build_task("side", vec![tasks.make_event_tag(&tasks.get_current_task().unwrap().event, MARKER_DEPENDS)])); assert_eq!(tasks.get_current_task().unwrap().children, HashSet::::new()); - let subid = tasks.make_task("sub"); - assert_eq!(tasks.get_current_task().unwrap().children, HashSet::from([subid])); - let sub = tasks.get_by_id(&subid).unwrap(); + let sub_id = tasks.make_task("sub"); + assert_eq!(tasks.get_current_task().unwrap().children, HashSet::from([sub_id])); + assert_eq!(tasks.len(), 3); + let sub = tasks.get_by_id(&sub_id).unwrap(); assert_eq!(sub.get_dependendees(), Vec::<&EventId>::new()); } #[test] fn test_tracking() { let mut tasks = stub_tasks(); + let zero = EventId::all_zeros(); - //let task = tasks.make_task("task"); tasks.track_at(Timestamp::from(0)); assert_eq!(tasks.history.len(), 1); - let zero = EventId::all_zeros(); tasks.move_to(Some(zero)); let now: Timestamp = Timestamp::now() - 2u64; @@ -1090,10 +1090,11 @@ mod tasks_test { fn test_timestamps() { let mut tasks = stub_tasks(); let zero = EventId::all_zeros(); + tasks.move_to(Some(zero)); tasks.track_at(Timestamp::from(Timestamp::now().as_u64() + 100)); assert_eq!(timestamps(tasks.history.values().nth(0).unwrap().into_iter(), &vec![&zero]).collect_vec().len(), 2) - // TODO Does not show both future and current tracking properly, need to split by now + // TODO Does not show both future and current tracking properly, need to split by current time }