(self, capacity: int = 16, seed: int = None, prepopulate: int = 0)
| 34 | """Fuzz tester for B+ Tree with operation tracking and reference comparison""" |
| 35 | |
| 36 | def __init__(self, capacity: int = 16, seed: int = None, prepopulate: int = 0): |
| 37 | self.capacity = capacity |
| 38 | self.seed = seed or random.randint(1, 1000000) |
| 39 | self.prepopulate = prepopulate |
| 40 | random.seed(self.seed) |
| 41 | |
| 42 | # Initialize data structures |
| 43 | self.btree = BPlusTreeMap(capacity=capacity) |
| 44 | self.reference = OrderedDict() |
| 45 | |
| 46 | # Pre-populate if requested |
| 47 | if prepopulate > 0: |
| 48 | self._prepopulate_tree(prepopulate) |
| 49 | |
| 50 | # Operation tracking for debugging |
| 51 | self.operations: List[Tuple[str, Any, Any]] = [] |
| 52 | self.operation_count = 0 |
| 53 | |
| 54 | # Statistics |
| 55 | self.stats = { |
| 56 | "insert": 0, |
| 57 | "delete": 0, |
| 58 | "update": 0, |
| 59 | "get": 0, |
| 60 | "batch_delete": 0, |
| 61 | "compact": 0, |
| 62 | "errors": 0, |
| 63 | "prepopulate": prepopulate, |
| 64 | } |
| 65 | |
| 66 | def log_operation( |
| 67 | self, op_type: str, key: Any = None, value: Any = None, extra: Any = None |
nothing calls this directly
no test coverage detected