MCPcopy
hub / github.com/google/mangle / TestReducerMinMaxSumNegative

Function TestReducerMinMaxSumNegative

functional/functional_test.go:302–332  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

300}
301
302func TestReducerMinMaxSumNegative(t *testing.T) {
303 tests := []struct {
304 rows [][]ast.Constant
305 }{
306 {
307 rows: [][]ast.Constant{
308 {ast.Number(1)},
309 {ast.Float64(1.0)},
310 {ast.Number(3)},
311 },
312 },
313 }
314 for _, test := range tests {
315 var rows []ast.ConstSubstList
316 for _, row := range test.rows {
317 rows = append(rows, makeConstSubstList([]ast.Variable{ast.Variable{"X"}}, row))
318 }
319 if got, err := EvalReduceFn(ast.ApplyFn{symbols.Max, []ast.BaseTerm{ast.Variable{"X"}}}, rows); err == nil {
320 // if NO error
321 t.Fatalf("EvalReduceFn(Max,%v) = %v want error", rows, got)
322 }
323 if got, err := EvalReduceFn(ast.ApplyFn{symbols.Min, []ast.BaseTerm{ast.Variable{"X"}}}, rows); err == nil {
324 // if NO error
325 t.Fatalf("EvalReduceFn(Min,%v) = %v want error", rows, got)
326 }
327 if got, err := EvalReduceFn(ast.ApplyFn{symbols.Sum, []ast.BaseTerm{ast.Variable{"X"}}}, rows); err == nil {
328 // if NO error
329 t.Fatalf("EvalReduceFn(Sum,%v) = %v want error", rows, got)
330 }
331 }
332}
333
334func TestReducerFloatMinMaxSum(t *testing.T) {
335 tests := []struct {

Callers

nothing calls this directly

Calls 4

NumberFunction · 0.92
Float64Function · 0.92
makeConstSubstListFunction · 0.85
EvalReduceFnFunction · 0.85

Tested by

no test coverage detected