MCPcopy
hub / github.com/segmentio/ksuid / TestSort

Function TestSort

ksuid_test.go:256–280  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

254}
255
256func TestSort(t *testing.T) {
257 ids1 := [11]KSUID{}
258 ids2 := [11]KSUID{}
259
260 for i := range ids1 {
261 ids1[i] = New()
262 }
263
264 ids2 = ids1
265 sort.Slice(ids2[:], func(i, j int) bool {
266 return Compare(ids2[i], ids2[j]) < 0
267 })
268
269 Sort(ids1[:])
270
271 if !IsSorted(ids1[:]) {
272 t.Error("not sorted")
273 }
274
275 if ids1 != ids2 {
276 t.Error("bad order:")
277 t.Log(ids1)
278 t.Log(ids2)
279 }
280}
281
282func TestPrevNext(t *testing.T) {
283 tests := []struct {

Callers

nothing calls this directly

Calls 4

NewFunction · 0.85
CompareFunction · 0.85
SortFunction · 0.85
IsSortedFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…