You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: pairing_heap_test.go
    path of file: ./repos/vald/pkg/gateway/lb/handler/grpc
    
    the code of the file until where you have to start completion: // Copyright (C) 2019-2024 vdaas.org vald team <vald@vdaas.org>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//	https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package grpc

import (
	"fmt"
	"math/big"
	"testing"

	"github.com/vdaas/vald/apis/grpc/v1/payload"
	"github.com/vdaas/vald/int
    
func TestPairingHeap(t *testing.T) {
	type test struct {
		name      string
		args      []*DistPayload
		checkFunc func([]*DistPayload) error
	}
	defaultCheckFunc := func(got []*DistPayload) error {
		last := got[0].distance
		for i, current := range got {
			cmp := last.Cmp(current.distance)
			if cmp > 0 {
				gids := make([]string, 0, len(got))
				for i, dp := range got {
					gids = append(gids, fmt.Sprintf("%d:%s:%f", i, dp.raw.GetId(), dp.raw.GetDistance()))
				}
				return errors.Errorf(
					"unsorted return detected cmp: %d, last: %s, current: %s, got: idx=%d,\tid=%s,\traw[\"%#v\"]",
					cmp,
					last.String(),
					current.distance.String(),
					i,
					got[i].raw.GetId(),
					gids,
				)
			}
			last = current.distance
		}
		return nil
	}
	tests := []test{
		func() test {
			dl := 100
			ods := make([]*payload.Object_Distance, 0, dl)
			for i := 0; i < dl; i++ {
				ods = append(ods, &payload.Object_Distance{
					Id:       strings.Random(12),
					Distance: rand.Float32(),
				})
			}
			dps := make([]*DistPayload, 0, dl) // random DistPayload arguments for heap insert data
			for _, dist := range ods {
				dps = append(dps, &DistPayload{raw: dist, distance: big.NewFloat(float64(dist.GetDistance()))})
			}
			return test{
				name:      "check ExtractMin results are sorted",
				args:      dps,
				checkFunc: defaultCheckFunc,
			}
		}(),
	}

	for _, tc := range tests {
		test := tc
		t.Run(test.name, func(tt *testing.T) {
			tt.Parallel()
			defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
			checkFunc := test.checkFunc
			if test.checkFunc == nil {
				checkFunc = defaultCheckFunc
			}
			ph := new(PairingHeap)
			for _, dp := range test.args {
				ph = ph.Insert(dp)
			}
			result := make([]*DistPayload, 0, len(test.args))
			for !ph.IsEmpty() {
				var min *DistPayload
				min, ph = ph.ExtractMin()
				result = append(result, min)
			}
			if err := checkFunc(result); err != nil {
				tt.Errorf("error = %v", err)
			}
		})
	}
}