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

Function run_edge_case_tests

python/tests/comprehensive_fuzz_test.py:185–233  ·  view source on GitHub ↗

Test edge cases and boundary conditions

()

Source from the content-addressed store, hash-verified

183
184
185def run_edge_case_tests():
186 """Test edge cases and boundary conditions"""
187 print(f"\n🎯 EDGE CASE TESTS")
188 print("=" * 70)
189
190 edge_cases = [
191 # Minimum capacity
192 (16, 0, 10000, "Minimum capacity, empty start"),
193 (16, 10000, 10000, "Minimum capacity, large prepopulation"),
194 # Very large capacity (stress single-level trees)
195 (1024, 0, 10000, "Very large capacity, empty start"),
196 (1024, 50000, 10000, "Very large capacity, large prepopulation"),
197 # Extreme prepopulation ratios
198 (16, 100000, 5000, "Small capacity, huge prepopulation"),
199 (256, 1, 10000, "Large capacity, tiny prepopulation"),
200 ]
201
202 results = []
203 for capacity, prepopulate, operations, description in edge_cases:
204 print(f"\n🧪 {description}")
205 print(
206 f" Capacity={capacity}, Prepopulate={prepopulate:,}, Operations={operations:,}"
207 )
208
209 seed = random.randint(1, 1000000)
210
211 try:
212 tester = BPlusTreeFuzzTester(
213 capacity=capacity, seed=seed, prepopulate=prepopulate
214 )
215
216 start_time = time.time()
217 success = tester.run_fuzz_test(operations)
218 elapsed = time.time() - start_time
219
220 if success:
221 print(f" ✅ PASSED in {elapsed:.1f}s")
222 else:
223 print(f" ❌ FAILED (seed: {seed})")
224
225 results.append(success)
226
227 except Exception as e:
228 print(f" 💥 EXCEPTION: {e}")
229 results.append(False)
230
231 passed = sum(results)
232 print(f"\nEdge case summary: {passed}/{len(results)} passed")
233 return all(results)
234
235
236if __name__ == "__main__":

Callers 1

Calls 2

run_fuzz_testMethod · 0.95
BPlusTreeFuzzTesterClass · 0.90

Tested by

no test coverage detected