You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

35 lines
768 B

package aggregation
import (
"time"
"github.com/pingcap/check"
"github.com/pingcap/tidb/sessionctx/stmtctx"
"github.com/pingcap/tidb/types"
)
var _ = check.Suite(&testUtilSuite{})
type testUtilSuite struct {
}
func (s *testUtilSuite) TestDistinct(c *check.C) {
sc := &stmtctx.StatementContext{TimeZone: time.Local}
dc := createDistinctChecker(sc)
tests := []struct {
vals []interface{}
expect bool
}{
{[]interface{}{1, 1}, true},
{[]interface{}{1, 1}, false},
{[]interface{}{1, 2}, true},
{[]interface{}{1, 2}, false},
{[]interface{}{1, nil}, true},
{[]interface{}{1, nil}, false},
}
for _, tt := range tests {
d, err := dc.Check(types.MakeDatums(tt.vals...))
c.Assert(err, check.IsNil)
c.Assert(d, check.Equals, tt.expect)
}
}