Skip to content

Commit

Permalink
Added sort_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
kellegous committed Jan 11, 2018
1 parent 3f0a3d8 commit 188bcba
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
1 change: 0 additions & 1 deletion .gaan

This file was deleted.

3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
test:
go test github.com/kellegous/underpants/mux
go test github.com/kellegous/underpants/mux \
github.com/kellegous/underpants/util
30 changes: 30 additions & 0 deletions util/sort_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package util

import (
"sort"
"testing"
)

func TestWithInts(t *testing.T) {
v := []int{100, 101, 99, 98, 102}
Sort(len(v),
func(i, j int) bool {
return v[i] < v[j]
},
func(i, j int) {
v[i], v[j] = v[j], v[i]
})

if !sort.IntsAreSorted(v) {
t.Errorf("%v not sorted.", v)
}
}

func TestEmpty(t *testing.T) {
Sort(0,
func(i, j int) bool {
return false
},
func(i, j int) {
})
}

0 comments on commit 188bcba

Please sign in to comment.