Test Case Report: Sorting Algorithms (Numbers)
This report outlines key test scenarios for evaluating sorting algorithms such as Merge Sort (stable)
and Quick Sort (in-place). It includes functional accuracy, edge case behavior, and performance
under large-scale inputs.
1. Functional Test Cases
TC1.1 - Basic Unsorted List
Input: [5, 3, 8, 6, 2]
Expected Output: [2, 3, 5, 6, 8]
Remarks: Validate basic functionality
TC1.2 - Already Sorted List
Input: [1, 2, 3, 4, 5]
Expected Output: [1, 2, 3, 4, 5]
Remarks: Should remain unchanged
TC1.3 - List with Duplicates
Input: [4, 2, 2, 8, 5, 4]
Expected Output: [2, 2, 4, 4, 5, 8]
Remarks: Handles duplicates properly
TC1.4 - Empty List
Input: []
Expected Output: []
Remarks: Should not throw error
TC1.5 - Single Element List
Input: [10]
Expected Output: [10]
Remarks: Edge case - minimal input
TC1.6 - List with Negative Numbers
Input: [-3, -1, -7, 4, 2]
Expected Output: [-7, -3, -1, 2, 4]
Remarks: Sorts negative and positive
2. Edge Cases
TC2.1 - Large List (1 Million Elements)
Input: Random integers
Expected Output: Sorted ascending
Remarks: Tests memory use, scalability
TC2.2 - Identical Elements
Input: [5, 5, 5, 5, 5]
Expected Output: [5, 5, 5, 5, 5]
Remarks: Handle uniform data
TC2.3 - Extreme Integer Values
Input: [2147483647, 0, -1, 2147483647]
Expected Output: [-1, 0, 2147483647, 2147483647]
Remarks: Checks robustness
TC2.4 - Stability Test (Merge Sort)
Input: [(4,'a'), (2,'b'), (4,'c')]
Expected Output: [(2,'b'), (4,'a'), (4,'c')]
Remarks: Confirms stable sorting
3. Performance Tests
TC3.1 - Moderately Large Data Set
Input: 100,000 random integers
Expected Output: Sorted in ascending order
Benchmark: <= 1 second
TC3.2 - Nearly Sorted List
Input: [1, 2, 3, 4, 6, 5]
Expected Output: [1, 2, 3, 4, 5, 6]
Benchmark: Optimized performance expected
TC3.3 - Reverse Sorted List
Input: [5, 4, 3, 2, 1]
Expected Output: [1, 2, 3, 4, 5]
Benchmark: Worst case for Quick Sort (w/o pivoting)
4. Expected Behavior Summary
- Sorting Order: All algorithms must return a list sorted in ascending numerical order.
- Stability Requirement: Merge Sort (or other stable sort) should maintain order of equal elements.
- In-place vs. New List:
- Quick Sort: typically in-place, modifies original list.
- Merge Sort: often implemented to return a new sorted list.
- Performance Expectation:
- 1 million elements: <= 3 seconds on 2.5GHz CPU, 8GB RAM
- 100k elements: <= 1 second