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: analytic_function_test.go
    path of file: ./repos/csvq/lib/query
    
    the code of the file until where you have to start completion: package query

import (
	"context"
	"reflect"
	"testing"
	"time"

	"github.com/mithrandie/csvq/lib/parser"
	"github.com/mithrandie/csvq/lib/value"
)

var analyzeTests = []struct {
	Name             string
	CPU              int
	View             *View
	Scope            *ReferenceScope
	Function         parser.AnalyticFunction
	PartitionIndices []int
	Result           *View
	Error            
    
func TestAnalyze(t *testing.T) {
	defer initFlag(TestTx.Flags)

	for _, v := range analyzeTests {
		if 0 < v.CPU {
			TestTx.Flags.CPU = v.CPU
		} else {
			TestTx.Flags.CPU = 1
		}

		ctx := context.Background()
		if v.Scope == nil {
			v.Scope = NewReferenceScope(TestTx)
		}

		err := Analyze(ctx, v.Scope, v.View, v.Function, v.PartitionIndices)
		if err != nil {
			if len(v.Error) < 1 {
				t.Errorf("%s: unexpected error %q", v.Name, err)
			} else if err.Error() != v.Error {
				t.Errorf("%s: error %q, want error %q", v.Name, err.Error(), v.Error)
			}
			continue
		}
		if 0 < len(v.Error) {
			t.Errorf("%s: no error, want error %q", v.Name, v.Error)
			continue
		}

		if !reflect.DeepEqual(v.View, v.Result) {
			t.Errorf("%s: result = %v, want %v", v.Name, v.View, v.Result)
		}
	}
}