I spent too long on the happy path and nearly forgot to test the failure cases until they nudged me.
Start by outlining the test driver's structure: a main function that sequentially tests normal allocation, failure cases (overlapping, out-of-space), and fragmentation counting. Then, for each test, describe the expected behavior and how you would verify it, emphasizing edge cases like boundary conditions and full allocation.
Pro tip: Demonstrate thoroughness by including tests for zero-size allocations, allocations that exactly fit remaining space, and fragmentation after freeing blocks—these show you think beyond the obvious.
Review the class methods: allocate contiguous blocks, find free contiguous blocks, and count fragmentation holes. Know their parameters, return values, and side effects.
Plan a sequence of tests covering: successful allocation, allocation failure due to insufficient contiguous space, overlapping allocation attempt, and full bitmap. Also include fragmentation counting after allocations and frees.
Write a main function that creates a BitmapBlock instance, performs the planned operations, and checks results (e.g., return values, bitmap state) using assertions or printed output.
After presenting the driver, articulate which edge cases are tested and why they matter, such as boundary conditions, zero-size requests, and fragmentation scenarios.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.