1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/hanchuanchuan-goInception

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
util_test.go 879
Копировать Редактировать Исходные данные Просмотреть построчно История
hanchuanchuan Отправлено 6 лет назад 27f3c5a
package aggregation
import (
"time"
"github.com/hanchuanchuan/goInception/sessionctx/stmtctx"
"github.com/hanchuanchuan/goInception/types"
"github.com/hanchuanchuan/goInception/util/testleak"
"github.com/pingcap/check"
)
var _ = check.Suite(&testUtilSuite{})
type testUtilSuite struct {
}
func (s *testUtilSuite) TestDistinct(c *check.C) {
defer testleak.AfterTest(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)
}
}

Комментарий ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/hanchuanchuan-goInception.git
git@gitlife.ru:oschina-mirror/hanchuanchuan-goInception.git
oschina-mirror
hanchuanchuan-goInception
hanchuanchuan-goInception
v1.2.4