From aad3ea0c0a6fa09c74beb8185cadb17774f2545b Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Sat, 22 Feb 2025 12:19:49 -0500 Subject: [PATCH] improve future_moves tests --- src/logic/future_moves.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/logic/future_moves.rs b/src/logic/future_moves.rs index 4903a62..7f203f3 100644 --- a/src/logic/future_moves.rs +++ b/src/logic/future_moves.rs @@ -374,7 +374,7 @@ mod tests { lazy_children: false, }); - futm.current_root = Some(0); + futm.update_root_idx_raw(0); // child 1 futm.arena.push(Move::new( @@ -442,9 +442,23 @@ mod tests { lazy_children: false, }); - futm.current_root = Some(0); + futm.update_root_idx_raw(0); futm.extend_layers(); assert_eq!(futm.arena_len(), 5); + + // move to a child + futm.update_root_idx_raw(1); + futm.refocus_tree(); + assert_eq!(futm.arena_len(), 1); + + // make sure current_root is properly updated + assert_eq!(futm.current_root, Some(0)); + + futm.extend_layers(); + assert!( + futm.arena_len() > 1, + "extend_layer didn't grow arena after refocus" + ); } }