github.com/joomcode/cue@v0.4.4-0.20221111115225-539fe3512047/pkg/list/testdata/gen.txtar (about) 1 # generated from the original tests. 2 # Henceforth it may be nicer to group tests into separate files. 3 -- in.cue -- 4 import "list" 5 6 t1: list.Avg([1, 2, 3, 4]) 7 t2: list.Avg([]) 8 t3: list.Avg("foo") 9 t4: list.Drop([1, 2, 3, 4], 0) 10 t5: list.Drop([1, 2, 3, 4], 2) 11 t6: list.Drop([1, 2, 3, 4], 10) 12 t7: list.Drop([1, 2, 3, 4], -1) 13 t8: list.FlattenN([1, [[2, 3], []], [4]], -1) 14 t9: list.FlattenN([1, [[2, 3], []], [4]], 0) 15 t10: list.FlattenN([1, [[2, 3], []], [4]], 1) 16 t11: list.FlattenN([1, [[2, 3], []], [4]], 2) 17 t12: list.FlattenN([[1, 2] | *[]], -1) 18 t13: list.FlattenN("foo", 1) 19 t14: list.FlattenN([], "foo") 20 t15: list.Max([1, 2, 3, 4]) 21 t16: list.Max([]) 22 t17: list.Max("foo") 23 t18: list.Min([1, 2, 3, 4]) 24 t19: list.Min([]) 25 t20: list.Min("foo") 26 t21: list.Product([1, 2, 3, 4]) 27 t22: list.Product([]) 28 t23: list.Product("foo") 29 t24: list.Range(0, 5, 0) 30 t25: list.Range(5, 0, 1) 31 t26: list.Range(0, 5, -1) 32 t27: list.Range(0, 5, 1) 33 t28: list.Range(0, 1, 1) 34 t29: list.Range(0, 5, 2) 35 t30: list.Range(5, 0, -1) 36 t31: list.Range(0, 5, 0.5) 37 t32: list.Slice([1, 2, 3, 4], 1, 3) 38 t33: list.Slice([1, 2, 3, 4], -1, 3) 39 t34: list.Slice([1, 2, 3, 4], 3, 1) 40 t35: list.Slice([1, 2, 3, 4], 5, 5) 41 t36: list.Slice([1, 2, 3, 4], 1, 5) 42 t37: list.Sort([], list.Ascending) 43 t38: list.Sort([2, 3, 1, 4], {x: _, y: _, less: x < y}) 44 t39: list.SortStable([{a: 2, v: 1}, {a: 1, v: 2}, {a: 1, v: 3}], { 45 x: _ 46 y: _ 47 less: (x.a < y.a) 48 }) 49 t40: list.Sort([{a: 1}, {b: 2}], list.Ascending) 50 t41: list.SortStrings(["b", "a"]) 51 t42: list.SortStrings([1, 2]) 52 t43: list.Sum([1, 2, 3, 4]) 53 t44: list.Sum([]) 54 t45: list.Sum("foo") 55 t46: list.Take([1, 2, 3, 4], 0) 56 t47: list.Take([1, 2, 3, 4], 2) 57 t48: list.Take([1, 2, 3, 4], 10) 58 t49: list.Take([1, 2, 3, 4], -1) 59 t50: list.MinItems([1, 2, 3, 4], 2) 60 t51: list.MinItems([1, 2, 3, 4], 5) 61 t52: list.MaxItems([1, 2, 3, 4], 5) 62 t53: list.MaxItems([1, 2, 3, 4], 2) 63 t54: list.Sort([{a: 1}, {b: 2}], list.Ascending) 64 -- out/list -- 65 Errors: 66 error in call to list.Avg: empty list: 67 ./in.cue:4:6 68 t3: cannot use "foo" (type string) as list in argument 1 to list.Avg: 69 ./in.cue:5:15 70 error in call to list.Drop: negative index: 71 ./in.cue:9:6 72 error in call to list.FlattenN: cannot use value "foo" (type string) as list: 73 ./in.cue:15:6 74 ./in.cue:15:20 75 t14: cannot use "foo" (type string) as int in argument 2 to list.FlattenN: 76 ./in.cue:16:24 77 error in call to list.Max: empty list: 78 ./in.cue:18:6 79 t17: cannot use "foo" (type string) as list in argument 1 to list.Max: 80 ./in.cue:19:15 81 error in call to list.Min: empty list: 82 ./in.cue:21:6 83 t20: cannot use "foo" (type string) as list in argument 1 to list.Min: 84 ./in.cue:22:15 85 t23: cannot use "foo" (type string) as list in argument 1 to list.Product: 86 ./in.cue:25:19 87 error in call to list.Range: step must be non zero: 88 ./in.cue:26:6 89 error in call to list.Range: end must be greater than start when step is positive: 90 ./in.cue:27:6 91 error in call to list.Range: end must be less than start when step is negative: 92 ./in.cue:28:6 93 error in call to list.Slice: negative index: 94 ./in.cue:35:6 95 error in call to list.Slice: invalid index: 3 > 1: 96 ./in.cue:36:6 97 error in call to list.Slice: slice bounds out of range: 98 ./in.cue:37:6 99 error in call to list.Slice: slice bounds out of range: 100 ./in.cue:38:6 101 Ascending.x: error in call to list.Sort: 2 errors in empty disjunction:: 102 ./in.cue:46:6 103 Ascending.y: error in call to list.Sort: 2 errors in empty disjunction:: 104 ./in.cue:46:6 105 t42: invalid list element 0 in argument 0 to call: cannot use value 1 (int) as string: 106 ./in.cue:48:6 107 ./in.cue:48:24 108 t45: cannot use "foo" (type string) as list in argument 1 to list.Sum: 109 ./in.cue:51:15 110 error in call to list.Take: negative index: 111 ./in.cue:55:6 112 Ascending.x: error in call to list.Sort: 2 errors in empty disjunction:: 113 ./in.cue:60:6 114 Ascending.y: error in call to list.Sort: 2 errors in empty disjunction:: 115 ./in.cue:60:6 116 117 Result: 118 t1: 2.5 119 t2: _|_ // error in call to list.Avg: empty list 120 t3: _|_ // t3: cannot use "foo" (type string) as list in argument 1 to list.Avg 121 t4: [1, 2, 3, 4] 122 t5: [3, 4] 123 t6: [] 124 t7: _|_ // error in call to list.Drop: negative index 125 t8: [1, 2, 3, 4] 126 t9: [1, [[2, 3], []], [4]] 127 t10: [1, [2, 3], [], 4] 128 t11: [1, 2, 3, 4] 129 t12: [] 130 t13: _|_ // error in call to list.FlattenN: cannot use value "foo" (type string) as list 131 t14: _|_ // t14: cannot use "foo" (type string) as int in argument 2 to list.FlattenN 132 t15: 4 133 t16: _|_ // error in call to list.Max: empty list 134 t17: _|_ // t17: cannot use "foo" (type string) as list in argument 1 to list.Max 135 t18: 1 136 t19: _|_ // error in call to list.Min: empty list 137 t20: _|_ // t20: cannot use "foo" (type string) as list in argument 1 to list.Min 138 t21: 24 139 t22: 1 140 t23: _|_ // t23: cannot use "foo" (type string) as list in argument 1 to list.Product 141 t24: _|_ // error in call to list.Range: step must be non zero 142 t25: _|_ // error in call to list.Range: end must be greater than start when step is positive 143 t26: _|_ // error in call to list.Range: end must be less than start when step is negative 144 t27: [0, 1, 2, 3, 4] 145 t28: [0] 146 t29: [0, 2, 4] 147 t30: [5, 4, 3, 2, 1] 148 t31: [0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5] 149 t32: [2, 3] 150 t33: _|_ // error in call to list.Slice: negative index 151 t34: _|_ // error in call to list.Slice: invalid index: 3 > 1 152 t35: _|_ // error in call to list.Slice: slice bounds out of range 153 t36: _|_ // error in call to list.Slice: slice bounds out of range 154 t37: [] 155 t38: [1, 2, 3, 4] 156 t39: [{ 157 a: 1 158 v: 2 159 }, { 160 a: 1 161 v: 3 162 }, { 163 a: 2 164 v: 1 165 }] 166 t40: _|_ // error in call to list.Sort: Ascending.x: 2 errors in empty disjunction: (and 5 more errors) 167 t41: ["a", "b"] 168 t42: _|_ // t42: invalid list element 0 in argument 0 to call: cannot use value 1 (int) as string 169 t43: 10 170 t44: 0 171 t45: _|_ // t45: cannot use "foo" (type string) as list in argument 1 to list.Sum 172 t46: [] 173 t47: [1, 2] 174 t48: [1, 2, 3, 4] 175 t49: _|_ // error in call to list.Take: negative index 176 t50: true 177 t51: false 178 t52: true 179 t53: false 180 t54: _|_ // error in call to list.Sort: Ascending.x: 2 errors in empty disjunction: (and 5 more errors) 181