Пример #1
0
func TestSum(t *testing.T) {
	sum := nodes.Sum(1)
	expected := "SUM(1)"
	if got, _ := sql.Accept(sum); expected != got {
		t.Errorf("TestSum was expected to return %s, got %s", expected, got)
	}
}
Пример #2
0
func TestExtensiveFunction(t *testing.T) {
	function := nodes.Sum(1).Or(nodes.Count(2).And(nodes.Average(3)))
	expected := "(SUM(1) OR (COUNT(2) AND AVG(3)))"
	if got, _ := sql.Accept(function); expected != got {
		t.Errorf("TestExtensiveFunction was expected to return %s, got %s", expected, got)
	}
}
Пример #3
0
func TestSum(t *testing.T) {
	sum := nodes.Sum(1, 2, 3, 4)

	// The following struct members should exist.
	_ = sum.Expressions
	_ = sum.Alias
	_ = sum.Distinct

	// The following receiver methods should exist.
	_ = sum.And(1)
	_ = sum.Or(1)
	_ = sum.Eq(1)
	_ = sum.Neq(1)
	_ = sum.Gt(1)
	_ = sum.Gte(1)
	_ = sum.Lt(1)
	_ = sum.Lte(1)
	_ = sum.Like(1)
	_ = sum.Unlike(1)
}