Test different capacities with various initial loads
()
| 16 | |
| 17 | |
| 18 | def run_capacity_sweep(): |
| 19 | """Test different capacities with various initial loads""" |
| 20 | print("🧪 Comprehensive Fuzz Testing: Capacity & Load Sweep") |
| 21 | print("=" * 70) |
| 22 | |
| 23 | # Test configurations: (capacity, prepopulate, operations) |
| 24 | test_configs = [ |
| 25 | # Small capacities (stress tree depth) |
| 26 | (16, 0, 25000), # Empty start, small capacity |
| 27 | (16, 100, 25000), # Small prepopulation |
| 28 | (16, 1000, 25000), # Large prepopulation |
| 29 | # Medium capacities |
| 30 | (16, 0, 25000), # Empty start |
| 31 | (16, 500, 25000), # Medium prepopulation |
| 32 | (16, 2000, 25000), # Large prepopulation |
| 33 | # Large capacities (our optimized range) |
| 34 | (64, 0, 25000), # Empty start |
| 35 | (64, 1000, 25000), # Medium prepopulation |
| 36 | (64, 5000, 25000), # Large prepopulation |
| 37 | (128, 0, 25000), # Empty start |
| 38 | (128, 2000, 25000), # Medium prepopulation |
| 39 | (128, 10000, 25000), # Large prepopulation |
| 40 | (256, 0, 25000), # Our optimal capacity |
| 41 | (256, 5000, 25000), # Medium prepopulation |
| 42 | (256, 20000, 25000), # Large prepopulation |
| 43 | # Very large capacities |
| 44 | (512, 0, 25000), # Empty start |
| 45 | (512, 10000, 25000), # Large prepopulation |
| 46 | ] |
| 47 | |
| 48 | results = [] |
| 49 | total_start = time.time() |
| 50 | |
| 51 | for i, (capacity, prepopulate, operations) in enumerate(test_configs): |
| 52 | print( |
| 53 | f"\n📋 Test {i+1}/{len(test_configs)}: Capacity={capacity}, Prepopulate={prepopulate:,}, Ops={operations:,}" |
| 54 | ) |
| 55 | print("-" * 70) |
| 56 | |
| 57 | # Use different seed for each test |
| 58 | seed = random.randint(1, 1000000) |
| 59 | |
| 60 | try: |
| 61 | start_time = time.time() |
| 62 | tester = BPlusTreeFuzzTester( |
| 63 | capacity=capacity, seed=seed, prepopulate=prepopulate |
| 64 | ) |
| 65 | |
| 66 | success = tester.run_fuzz_test(operations) |
| 67 | elapsed = time.time() - start_time |
| 68 | |
| 69 | result = { |
| 70 | "capacity": capacity, |
| 71 | "prepopulate": prepopulate, |
| 72 | "operations": operations, |
| 73 | "success": success, |
| 74 | "time": elapsed, |
| 75 | "seed": seed, |
no test coverage detected