Skip to content

Instantly share code, notes, and snippets.

@cipepser
Created January 15, 2017 12:15
Show Gist options
  • Save cipepser/59f87abcfd8397c552fcaddf79e143ca to your computer and use it in GitHub Desktop.
Save cipepser/59f87abcfd8397c552fcaddf79e143ca to your computer and use it in GitHub Desktop.
package MySort
import (
"testing"
"reflect"
"sort"
)
func TestBubbleSort(t *testing.T) {
for _, actual := range SortTests {
expected := make([]int, len(actual))
copy(expected, actual)
sort.Ints(expected)
BubbleSort(actual)
if !reflect.DeepEqual(actual, expected) {
t.Errorf("\nexpected: %v\nactual: %v", expected, actual)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment