Skip to content

Instantly share code, notes, and snippets.

@didil
Created January 26, 2023 14:40
Show Gist options
  • Save didil/b65016b6d1830aa5bf06364deb261115 to your computer and use it in GitHub Desktop.
Save didil/b65016b6d1830aa5bf06364deb261115 to your computer and use it in GitHub Desktop.
test go iteration sort generics ordered
func TestInsertSortGenericInt(t *testing.T) {
items := []int{3, 55, 4, 9, 8, 7, 67, 51}
InsertSort(items)
assert.Equal(t, items, []int{3, 4, 7, 8, 9, 51, 55, 67})
}
func TestInsertSortGenericString(t *testing.T) {
items := []string{"mike", "john", "adil", "aaron", "julia"}
InsertSort(items)
assert.Equal(t, items, []string{"aaron", "adil", "john", "julia", "mike"})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment