sorting-algorithms-lib
Version:
sorting-algorithms-lib is a lightweight JavaScript library that provides efficient implementations of various sorting algorithms. Whether you're learning algorithms, benchmarking performance, or building a project that requires sorting, this library has y
16 lines (13 loc) • 551 B
text/typescript
import { quickSort } from '../shortAlgorithms/QuickSort';
describe('QuickSort Algorithm', () => {
test('should sort an array of numbers', () => {
const input = [3, 1, 4, 1, 5, 9, 2, 6, 5];
const sorted = quickSort(input, 0, input.length - 1);
expect(sorted).toEqual([1, 1, 2, 3, 4, 5, 5, 6, 9]);
});
test('should sort an array of strings', () => {
const input = ['c', 'a', 'd', 'b', 'e'];
const sorted = quickSort(input, 0, input.length - 1);
expect(sorted).toEqual(['a', 'b', 'c', 'd', 'e']);
});
});