MCPcopy Create free account
hub / github.com/KentBeck/BPlusTree3 / test_overflow

Function test_overflow

rust/tests/bplus_tree.rs:118–136  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

116
117#[test]
118fn test_overflow() {
119 let mut tree = create_tree_4();
120 // With capacity=4, need 5 items to force a split
121 tree.insert(1, "one".to_string());
122 tree.insert(2, "two".to_string());
123 tree.insert(3, "three".to_string());
124 tree.insert(4, "four".to_string());
125 tree.insert(5, "five".to_string());
126
127 assert_invariants(&tree, "overflow test");
128 assert_eq!(tree.len(), 5);
129 assert_eq!(tree.get(&1), Some(&"one".to_string()));
130 assert_eq!(tree.get(&2), Some(&"two".to_string()));
131 assert_eq!(tree.get(&3), Some(&"three".to_string()));
132 assert_eq!(tree.get(&4), Some(&"four".to_string()));
133 assert_eq!(tree.get(&5), Some(&"five".to_string()));
134
135 assert!(!tree.is_leaf_root());
136}
137
138#[test]
139fn test_split_then_add() {

Callers

nothing calls this directly

Calls 3

create_tree_4Function · 0.85
assert_invariantsFunction · 0.85
insertMethod · 0.45

Tested by

no test coverage detected