fix(package): [algorithm] keep duplicate CountSort entries (#387)

This commit is contained in:
Yusuf Efe authored and GitHub committed 2026-10-22 10:56:56 +08:00
1 parent 3811d3db8e
commit cb45ef2d36
2 files changed
+5 -1

No files matched your search

+3
View File
@@ -199,6 +199,9 @@ func TestMergeSort(t *testing.T) {
func TestCountSort(t *testing.T) {
t.Parallel()
assert := internal.NewAssert(t, "TestCountSort")
assert.Equal([]int{1, 2, 2}, CountSort([]int{2, 1, 2}, &intComparator{}))
assert.Equal([]people{{"young", 10}, {"first", 20}, {"second", 20}},
CountSort([]people{{"first", 20}, {"young", 10}, {"second", 20}}, &peopleAgeComparator{}))
peoples := []people{
{Name: "a", Age: 20},