github.com/whtcorpsinc/MilevaDB-Prod@v0.0.0-20211104133533-f57f4be3b597/interlock/aggfuncs/func_varpop_test.go (about)

     1  package aggfuncs_test
     2  
     3  import (
     4  	. "github.com/whtcorpsinc/check"
     5  	"github.com/whtcorpsinc/BerolinaSQL/ast"
     6  	"github.com/whtcorpsinc/BerolinaSQL/allegrosql"
     7  	"github.com/whtcorpsinc/milevadb/interlock/aggfuncs"
     8  	"github.com/whtcorpsinc/milevadb/types"
     9  )
    10  
    11  func (s *testSuite) TestMergePartialResult4Varpop(c *C) {
    12  	tests := []aggTest{
    13  		builPosetDaggTester(ast.AggFuncVarPop, allegrosql.TypeDouble, 5, types.NewFloat64Causet(float64(2)), types.NewFloat64Causet(float64(2)/float64(3)), types.NewFloat64Causet(float64(59)/float64(8)-float64(19*19)/float64(8*8))),
    14  	}
    15  	for _, test := range tests {
    16  		s.testMergePartialResult(c, test)
    17  	}
    18  }
    19  
    20  func (s *testSuite) TestVarpop(c *C) {
    21  	tests := []aggTest{
    22  		builPosetDaggTester(ast.AggFuncVarPop, allegrosql.TypeDouble, 5, nil, types.NewFloat64Causet(float64(2))),
    23  	}
    24  	for _, test := range tests {
    25  		s.testAggFunc(c, test)
    26  	}
    27  }
    28  
    29  func (s *testSuite) TestMemVarpop(c *C) {
    30  	tests := []aggMemTest{
    31  		builPosetDaggMemTester(ast.AggFuncVarPop, allegrosql.TypeDouble, 5,
    32  			aggfuncs.DefPartialResult4VarPopFloat64Size, defaultUFIDelateMemDeltaGens, false),
    33  		builPosetDaggMemTester(ast.AggFuncVarPop, allegrosql.TypeDouble, 5,
    34  			aggfuncs.DefPartialResult4VarPoFIDelistinctFloat64Size, distinctUFIDelateMemDeltaGens, true),
    35  	}
    36  	for _, test := range tests {
    37  		s.testAggMemFunc(c, test)
    38  	}
    39  }