blob: bb1a9ac2c0c6bfc018108eb29f3618e6ff2a74d5 [file] [log] [blame]
# generated from the original tests.
# Henceforth it may be nicer to group tests into separate files.
-- in.cue --
import "list"
t1: list.Avg([1, 2, 3, 4])
t2: list.Avg([])
t3: list.Avg("foo")
t4: list.Drop([1, 2, 3, 4], 0)
t5: list.Drop([1, 2, 3, 4], 2)
t6: list.Drop([1, 2, 3, 4], 10)
t7: list.Drop([1, 2, 3, 4], -1)
t8: list.FlattenN([1, [[2, 3], []], [4]], -1)
t9: list.FlattenN([1, [[2, 3], []], [4]], 0)
t10: list.FlattenN([1, [[2, 3], []], [4]], 1)
t11: list.FlattenN([1, [[2, 3], []], [4]], 2)
t12: list.FlattenN([[1, 2] | *[]], -1)
t13: list.FlattenN("foo", 1)
t14: list.FlattenN([], "foo")
t15: list.Max([1, 2, 3, 4])
t16: list.Max([])
t17: list.Max("foo")
t18: list.Min([1, 2, 3, 4])
t19: list.Min([])
t20: list.Min("foo")
t21: list.Product([1, 2, 3, 4])
t22: list.Product([])
t23: list.Product("foo")
t24: list.Range(0, 5, 0)
t25: list.Range(5, 0, 1)
t26: list.Range(0, 5, -1)
t27: list.Range(0, 5, 1)
t28: list.Range(0, 1, 1)
t29: list.Range(0, 5, 2)
t30: list.Range(5, 0, -1)
t31: list.Range(0, 5, 0.5)
t32: list.Slice([1, 2, 3, 4], 1, 3)
t33: list.Slice([1, 2, 3, 4], -1, 3)
t34: list.Slice([1, 2, 3, 4], 3, 1)
t35: list.Slice([1, 2, 3, 4], 5, 5)
t36: list.Slice([1, 2, 3, 4], 1, 5)
t37: list.Sort([], list.Ascending)
t38: list.Sort([2, 3, 1, 4], {x:_, y:_, less: x<y})
t39: list.SortStable([{a:2,v:1}, {a:1,v:2}, {a:1,v:3}], {
x:_,
y:_,
less: (x.a < y.a)
})
t40: list.Sort([{a:1}, {b:2}], list.Ascending)
t41: list.SortStrings(["b", "a"])
t42: list.SortStrings([1, 2])
t43: list.Sum([1, 2, 3, 4])
t44: list.Sum([])
t45: list.Sum("foo")
t46: list.Take([1, 2, 3, 4], 0)
t47: list.Take([1, 2, 3, 4], 2)
t48: list.Take([1, 2, 3, 4], 10)
t49: list.Take([1, 2, 3, 4], -1)
t50: list.MinItems([1, 2, 3, 4], 2)
t51: list.MinItems([1, 2, 3, 4], 5)
t52: list.MaxItems([1, 2, 3, 4], 5)
t53: list.MaxItems([1, 2, 3, 4], 2)
t54: list.Sort([{a:1}, {b:2}], list.Ascending)
-- out/list --
Errors:
error in call to list.Avg: empty list
error in call to list.Drop: negative index
error in call to list.Max: empty list
error in call to list.Min: empty list
error in call to list.Range: end must be greater than start when step is positive
error in call to list.Range: end must be less than start when step is negative
error in call to list.Range: step must be non zero
error in call to list.Slice: invalid index: 3 > 1
error in call to list.Slice: negative index
error in call to list.Slice: slice bounds out of range
error in call to list.Take: negative index
Ascending.x: error in call to list.Sort: 2 errors in empty disjunction:
Ascending.x: error in call to list.Sort: conflicting values number and {b:2} (mismatched types number and struct):
./in.cue:46:24
list:10:9
Ascending.x: error in call to list.Sort: conflicting values string and {b:2} (mismatched types string and struct):
./in.cue:46:24
list:10:18
Ascending.y: error in call to list.Sort: 2 errors in empty disjunction:
Ascending.y: error in call to list.Sort: conflicting values number and {a:1} (mismatched types number and struct):
./in.cue:46:17
list:10:9
Ascending.y: error in call to list.Sort: conflicting values string and {a:1} (mismatched types string and struct):
./in.cue:60:17
list:10:18
t3: cannot use "foo" (type string) as list in argument 1 to list.Avg:
./in.cue:5:14
error in call to list.FlattenN: cannot use value "foo" (type string) as list:
./in.cue:15:20
t14: cannot use "foo" (type string) as int in argument 2 to list.FlattenN:
./in.cue:16:24
t17: cannot use "foo" (type string) as list in argument 1 to list.Max:
./in.cue:19:15
t20: cannot use "foo" (type string) as list in argument 1 to list.Min:
./in.cue:22:15
t23: cannot use "foo" (type string) as list in argument 1 to list.Product:
./in.cue:25:19
t42: invalid type element 0 (int) of string list argument 0:
./in.cue:48:6
t45: cannot use "foo" (type string) as list in argument 1 to list.Sum:
./in.cue:51:15
Result:
t1: 2.5
t2: _|_ // error in call to list.Avg: empty list (and 1 more errors)
t3: _|_ // t3: cannot use "foo" (type string) as list in argument 1 to list.Avg
t4: [1, 2, 3, 4]
t5: [3, 4]
t6: []
t7: _|_ // error in call to list.Drop: negative index (and 1 more errors)
t8: [1, 2, 3, 4]
t9: [1, [[2, 3], []], [4]]
t10: [1, [2, 3], [], 4]
t11: [1, 2, 3, 4]
t12: []
t13: _|_ // error in call to list.FlattenN: cannot use value "foo" (type string) as list (and 1 more errors)
t14: _|_ // t14: cannot use "foo" (type string) as int in argument 2 to list.FlattenN
t15: 4
t16: _|_ // error in call to list.Max: empty list (and 1 more errors)
t17: _|_ // t17: cannot use "foo" (type string) as list in argument 1 to list.Max
t18: 1
t19: _|_ // error in call to list.Min: empty list (and 1 more errors)
t20: _|_ // t20: cannot use "foo" (type string) as list in argument 1 to list.Min
t21: 24
t22: 1
t23: _|_ // t23: cannot use "foo" (type string) as list in argument 1 to list.Product
t24: _|_ // error in call to list.Range: step must be non zero (and 1 more errors)
t25: _|_ // error in call to list.Range: end must be greater than start when step is positive (and 1 more errors)
t26: _|_ // error in call to list.Range: end must be less than start when step is negative (and 1 more errors)
t27: [0, 1, 2, 3, 4]
t28: [0]
t29: [0, 2, 4]
t30: [5, 4, 3, 2, 1]
t31: [0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5]
t32: [2, 3]
t33: _|_ // error in call to list.Slice: negative index (and 1 more errors)
t34: _|_ // error in call to list.Slice: invalid index: 3 > 1 (and 1 more errors)
t35: _|_ // error in call to list.Slice: slice bounds out of range (and 1 more errors)
t36: _|_ // error in call to list.Slice: slice bounds out of range (and 1 more errors)
t37: []
t38: [1, 2, 3, 4]
t39: [{
a: 1
v: 2
}, {
a: 1
v: 3
}, {
a: 2
v: 1
}]
t40: _|_ // error in call to list.Sort: Ascending.x: 2 errors in empty disjunction: (and 11 more errors)
t41: ["a", "b"]
t42: _|_ // t42: invalid type element 0 (int) of string list argument 0 (and 1 more errors)
t43: 10
t44: 0
t45: _|_ // t45: cannot use "foo" (type string) as list in argument 1 to list.Sum
t46: []
t47: [1, 2]
t48: [1, 2, 3, 4]
t49: _|_ // error in call to list.Take: negative index (and 1 more errors)
t50: true
t51: false
t52: true
t53: false
t54: _|_ // error in call to list.Sort: Ascending.x: 2 errors in empty disjunction: (and 11 more errors)