github.com/hereyou-go/web@v0.0.0-20170331223219-492d98f91627/utils/sort_test.go (about)

     1  package utils
     2  
     3  import (
     4  	"sort"
     5  	"testing"
     6  )
     7  
     8  var arr = []int{1, 2, 3}
     9  var si = SortInterface(len(arr), func(i, j int) bool {
    10  	return i < j
    11  }, func(i, j int) {
    12  	arr[i], arr[j] = arr[j], arr[i]
    13  })
    14  
    15  func TestReverse(t *testing.T) {
    16  	sort.Sort(sort.Reverse(si))
    17  	//t.Fatal(arr)
    18  }
    19  
    20  func BenchmarkReverse(b *testing.B) {
    21  	sort.Sort(sort.Reverse(si))
    22  }