in_flight_pqueue_test.go (nsq-1.2.0) | : | in_flight_pqueue_test.go (nsq-1.2.1) | ||
---|---|---|---|---|
skipping to change at line 42 | skipping to change at line 42 | |||
ints := make([]int, 0, c) | ints := make([]int, 0, c) | |||
for i := 0; i < c; i++ { | for i := 0; i < c; i++ { | |||
v := rand.Int() | v := rand.Int() | |||
ints = append(ints, v) | ints = append(ints, v) | |||
pq.Push(&Message{pri: int64(v)}) | pq.Push(&Message{pri: int64(v)}) | |||
} | } | |||
test.Equal(t, c, len(pq)) | test.Equal(t, c, len(pq)) | |||
test.Equal(t, c, cap(pq)) | test.Equal(t, c, cap(pq)) | |||
sort.Sort(sort.IntSlice(ints)) | sort.Ints(ints) | |||
for i := 0; i < c; i++ { | for i := 0; i < c; i++ { | |||
msg, _ := pq.PeekAndShift(int64(ints[len(ints)-1])) | msg, _ := pq.PeekAndShift(int64(ints[len(ints)-1])) | |||
test.Equal(t, int64(ints[i]), msg.pri) | test.Equal(t, int64(ints[i]), msg.pri) | |||
} | } | |||
} | } | |||
func TestRemove(t *testing.T) { | func TestRemove(t *testing.T) { | |||
c := 100 | c := 100 | |||
pq := newInFlightPqueue(c) | pq := newInFlightPqueue(c) | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added |