package compute
import (
"fmt"
"testing"
"unsafe"
"github.com/daviszhen/plan/pkg/common"
"github.com/daviszhen/plan/pkg/util"
)
func Test_SumState(t *testing.T) {
{
var val State[common.Hugeint]
size := unsafe.Sizeof(val)
fmt.Println(size)
space := make([]byte, size)
ptr := util.BytesSliceToPointer(space)
state := *(*State[common.Hugeint])(ptr)
var hval common.Hugeint
state.SetValue(hval)
state.Init()
sop := SumStateOp[common.Hugeint]{}
sumop := SumOp[common.Hugeint, int32]{}
sumop.Init(&state, sop)
}
{
var val State[common.Hugeint]
size := unsafe.Sizeof(val)
fmt.Println(size)
space := make([]byte, size+20)
ptr := util.BytesSliceToPointer(space)
state := *(*State[common.Hugeint])(ptr)
var hval common.Hugeint
state.SetValue(hval)
state.Init()
sop := SumStateOp[common.Hugeint]{}
sumop := SumOp[common.Hugeint, int32]{}
sumop.Init(&state, sop)
}
}