Skip to content

Commit

Permalink
pull changes from bugfix PR
Browse files Browse the repository at this point in the history
  • Loading branch information
AlpinYukseloglu committed Mar 30, 2024
1 parent ed41043 commit 1511cd3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion contracts/sumtree-orderbook/src/sumtree/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ impl TreeNode {
let is_left_internal = maybe_left.clone().map_or(false, |l| l.is_internal());
let is_right_internal = maybe_right.clone().map_or(false, |r| r.is_internal());
let is_in_left_range = maybe_left.clone().map_or(false, |left| {
new_node.get_min_range() <= left.get_max_range()
new_node.get_min_range() < left.get_max_range()
});
let is_in_right_range = maybe_right.clone().map_or(false, |right| {
new_node.get_min_range() >= right.get_min_range()
Expand Down
10 changes: 10 additions & 0 deletions contracts/sumtree-orderbook/src/sumtree/test/test_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,16 @@ fn test_node_insert_valid() {
expected: vec![1, 5, 2, 4, 7, 3, 6],
print: true,
},
TestNodeInsertCase {
name: "Insert sequential nodes",
nodes: vec![
NodeType::leaf_uint256(5u128, 10u128),
NodeType::leaf_uint256(15u128, 20u128),
NodeType::leaf_uint256(35u128, 30u128),
],
expected: vec![1, 2, 5, 3, 4],
print: true,
},
];

for test in test_cases {
Expand Down

0 comments on commit 1511cd3

Please sign in to comment.