4 ms·
Usually the data is a combination of externally received information and internal calculations/annotations. I just use copious asserts, and one line: assert
by rogerbinns 14y ago
Usually the data is a combination of externally received information and internal calculations/annotations. I just use copious asserts, and one line:
assert bubble_sort(data) == sort(data)
Since this always runs during development it will automatically pick up internal and external changes.
What you laid out is explicitly testing everything against everything else and is 100% comprehensive. Bubble sort is less than 100% comprehensive but still gives good coverage, while optimised sorts just mean you get lucky in the face of buggy comparisons.