Skip to content

Verify post-order traversal in test_pairs_in_post_order#685

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/sub-pr-684
Draft

Verify post-order traversal in test_pairs_in_post_order#685
Copilot wants to merge 2 commits intomainfrom
copilot/sub-pr-684

Conversation

Copy link

Copilot AI commented Jan 26, 2026

The test_pairs_in_post_order test verified the count of pairs but not their actual ordering in post-order traversal (children before parents).

Changes

  • Added explicit assertions verifying inner pair (B . C) appears at index 0
  • Added explicit assertions verifying outer pair (A . (B . C)) appears at index 1
  • Added content validation for both pairs to confirm correct structure
  • Added assertion confirming outer pair's right child references inner pair
// Verify that inner_pair is actually the (B . C) pair
match tree.allocator.sexp(inner_pair) {
    SExp::Pair(left, right) => {
        assert_eq!(tree.allocator.atom(left).as_ref(), &[2]);
        assert_eq!(tree.allocator.atom(right).as_ref(), &[3]);
    }
    _ => panic!("Expected inner_pair to be a pair"),
}

// Verify that outer_pair is actually the (A . (B . C)) pair
match tree.allocator.sexp(outer_pair) {
    SExp::Pair(left, right) => {
        assert_eq!(tree.allocator.atom(left).as_ref(), &[1]);
        assert_eq!(right, inner_pair, "Outer pair's right child should be the inner pair");
    }
    _ => panic!("Expected outer_pair to be a pair"),
}

This ensures the documented post-order behavior of InternedTree::pairs is properly tested.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Update interning API to address review feedback Verify post-order traversal in test_pairs_in_post_order Jan 26, 2026
Copilot AI requested a review from richardkiss January 26, 2026 21:20
@richardkiss richardkiss force-pushed the generator-identity-hf branch 2 times, most recently from aabf999 to fd8698b Compare February 9, 2026 23:10
@richardkiss richardkiss force-pushed the generator-identity-hf branch 4 times, most recently from 3251a4e to 3a520de Compare February 18, 2026 00:05
Base automatically changed from generator-identity-hf to main February 19, 2026 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants