mirror of
https://github.com/duke-git/lancet.git
synced 2025-10-05 07:26:51 +08:00
feat: add ShellSort
This commit is contained in:
@@ -110,3 +110,16 @@ func TestSelectionSort(t *testing.T) {
|
||||
|
||||
asssert.Equal(expected, actual)
|
||||
}
|
||||
|
||||
func TestShellSort(t *testing.T) {
|
||||
asssert := internal.NewAssert(t, "TestShellSort")
|
||||
|
||||
comparator := &peopleAageComparator{}
|
||||
sortedPeopleByAge := ShellSort(peoples, comparator)
|
||||
t.Log(sortedPeopleByAge)
|
||||
|
||||
expected := "[{d 8} {b 10} {c 17} {a 20} {e 28}]"
|
||||
actual := fmt.Sprintf("%v", sortedPeopleByAge)
|
||||
|
||||
asssert.Equal(expected, actual)
|
||||
}
|
||||
|
Reference in New Issue
Block a user