Skip to content

Commit

Permalink
Sort, tweak test code layout, comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alnoki committed Oct 30, 2024
1 parent d14e1f5 commit 5442d36
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,6 @@ module red_black_map::red_black_map {
child_direction: u64
}

#[test_only]
fun assert_root_index<V>(self: &Map<V>, expected: u64) {
assert!(self.root == expected);
}

#[test_only]
fun assert_node<V: copy + drop>(
self: &Map<V>, index: u64, expected: MockNode<V>
Expand All @@ -224,6 +219,11 @@ module red_black_map::red_black_map {
assert!(node.children == expected.children);
}

#[test_only]
fun assert_root_index<V>(self: &Map<V>, expected: u64) {
assert!(self.root == expected);
}

#[test_only]
fun assert_search_result<V>(
self: &Map<V>, key: u256, expected: MockSearchResult
Expand Down Expand Up @@ -303,6 +303,7 @@ module red_black_map::red_black_map {
);

// Case_I56 (Case_I5 fall through to Case_I6): insert 8.
//
// | | |
// 5 (black, i = 0) 5 (black, i = 0) 8 (black, i = 2)
// \ \ / \
Expand Down Expand Up @@ -366,6 +367,7 @@ module red_black_map::red_black_map {
);

// Case_I2 fall through to Case_I3: insert 11.
//
// | |
// 8 (black, i = 2) 8 (red, i = 2)
// / \ / \
Expand Down Expand Up @@ -416,6 +418,7 @@ module red_black_map::red_black_map {
);

// Case_I1: insert 9.
//
// |
// 8 (red, i = 2)
// / \
Expand Down Expand Up @@ -479,10 +482,10 @@ module red_black_map::red_black_map {
}

#[test]
fun test_assorted(): Map<u256> {
fun test_bulk_insertions(): Map<u256> {
let map = new();

// Assert groups out of order to exercise rotations.
// Insert groups out of order to exercise rotations.
let keys = vector[
vector[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
vector[19, 18, 17, 16, 15, 14, 13, 12, 11, 10],
Expand Down

0 comments on commit 5442d36

Please sign in to comment.