cuelang.org/go@v0.10.1/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 t55: list.Avg([4, 8, 12]) 65 -- out/list-v3 -- 66 Errors: 67 t2: error in call to list.Avg: empty list: 68 ./in.cue:4:6 69 t3: cannot use "foo" (type string) as list in argument 1 to list.Avg: 70 ./in.cue:5:15 71 t7: error in call to list.Drop: negative index: 72 ./in.cue:9:6 73 t13: error in call to list.FlattenN: cannot use value "foo" (type string) as list: 74 ./in.cue:15:6 75 ./in.cue:15:20 76 t14: cannot use "foo" (type string) as int in argument 2 to list.FlattenN: 77 ./in.cue:16:24 78 t16: error in call to list.Max: empty list: 79 ./in.cue:18:6 80 t17: cannot use "foo" (type string) as list in argument 1 to list.Max: 81 ./in.cue:19:15 82 t19: error in call to list.Min: empty list: 83 ./in.cue:21:6 84 t20: cannot use "foo" (type string) as list in argument 1 to list.Min: 85 ./in.cue:22:15 86 t23: cannot use "foo" (type string) as list in argument 1 to list.Product: 87 ./in.cue:25:19 88 t24: error in call to list.Range: step must be non zero: 89 ./in.cue:26:6 90 t25: error in call to list.Range: end must be greater than start when step is positive: 91 ./in.cue:27:6 92 t26: error in call to list.Range: end must be less than start when step is negative: 93 ./in.cue:28:6 94 t33: error in call to list.Slice: negative index: 95 ./in.cue:35:6 96 t34: error in call to list.Slice: invalid index: 3 > 1: 97 ./in.cue:36:6 98 t35: error in call to list.Slice: slice bounds out of range: 99 ./in.cue:37:6 100 t36: error in call to list.Slice: slice bounds out of range: 101 ./in.cue:38:6 102 t40: error in call to list.Sort: conflicting values *adt.BasicType and *adt.StructLit (mismatched types number and struct): 103 ./in.cue:46:6 104 ./in.cue:46:25 105 list:10:9 106 t42: invalid list element 0 in argument 0 to call: cannot use value 1 (int) as string: 107 ./in.cue:48:6 108 ./in.cue:48:24 109 t45: cannot use "foo" (type string) as list in argument 1 to list.Sum: 110 ./in.cue:51:15 111 t49: error in call to list.Take: negative index: 112 ./in.cue:55:6 113 t54: error in call to list.Sort: conflicting values *adt.BasicType and *adt.StructLit (mismatched types number and struct): 114 ./in.cue:60:6 115 ./in.cue:60:25 116 list:10:9 117 118 Result: 119 t1: 2.5 120 t2: _|_ // t2: error in call to list.Avg: empty list 121 t3: _|_ // t3: cannot use "foo" (type string) as list in argument 1 to list.Avg 122 t4: [1, 2, 3, 4] 123 t5: [3, 4] 124 t6: [] 125 t7: _|_ // t7: error in call to list.Drop: negative index 126 t8: [1, 2, 3, 4] 127 t9: [1, [[2, 3], []], [4]] 128 t10: [1, [2, 3], [], 4] 129 t11: [1, 2, 3, 4] 130 t12: [] 131 t13: _|_ // t13: error in call to list.FlattenN: cannot use value "foo" (type string) as list 132 t14: _|_ // t14: cannot use "foo" (type string) as int in argument 2 to list.FlattenN 133 t15: 4 134 t16: _|_ // t16: error in call to list.Max: empty list 135 t17: _|_ // t17: cannot use "foo" (type string) as list in argument 1 to list.Max 136 t18: 1 137 t19: _|_ // t19: error in call to list.Min: empty list 138 t20: _|_ // t20: cannot use "foo" (type string) as list in argument 1 to list.Min 139 t21: 24 140 t22: 1 141 t23: _|_ // t23: cannot use "foo" (type string) as list in argument 1 to list.Product 142 t24: _|_ // t24: error in call to list.Range: step must be non zero 143 t25: _|_ // t25: error in call to list.Range: end must be greater than start when step is positive 144 t26: _|_ // t26: error in call to list.Range: end must be less than start when step is negative 145 t27: [0, 1, 2, 3, 4] 146 t28: [0] 147 t29: [0, 2, 4] 148 t30: [5, 4, 3, 2, 1] 149 t31: [0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5] 150 t32: [2, 3] 151 t33: _|_ // t33: error in call to list.Slice: negative index 152 t34: _|_ // t34: error in call to list.Slice: invalid index: 3 > 1 153 t35: _|_ // t35: error in call to list.Slice: slice bounds out of range 154 t36: _|_ // t36: error in call to list.Slice: slice bounds out of range 155 t37: [] 156 t38: [1, 2, 3, 4] 157 t39: [{ 158 a: 1 159 v: 2 160 }, { 161 a: 1 162 v: 3 163 }, { 164 a: 2 165 v: 1 166 }] 167 t40: _|_ // t40: error in call to list.Sort: Ascending.x: conflicting values *adt.BasicType and *adt.StructLit (mismatched types number and struct) 168 t41: ["a", "b"] 169 t42: _|_ // t42: invalid list element 0 in argument 0 to call: cannot use value 1 (int) as string 170 t43: 10 171 t44: 0 172 t45: _|_ // t45: cannot use "foo" (type string) as list in argument 1 to list.Sum 173 t46: [] 174 t47: [1, 2] 175 t48: [1, 2, 3, 4] 176 t49: _|_ // t49: error in call to list.Take: negative index 177 t50: true 178 t51: false 179 t52: true 180 t53: false 181 t54: _|_ // t54: error in call to list.Sort: Ascending.x: conflicting values *adt.BasicType and *adt.StructLit (mismatched types number and struct) 182 t55: 8 183 -- diff/-out/list-v3<==>+out/list -- 184 diff old new 185 --- old 186 +++ new 187 @@ -34,9 +34,10 @@ 188 ./in.cue:37:6 189 t36: error in call to list.Slice: slice bounds out of range: 190 ./in.cue:38:6 191 -t40: error in call to list.Sort: 2 errors in empty disjunction:: 192 +t40: error in call to list.Sort: conflicting values *adt.BasicType and *adt.StructLit (mismatched types number and struct): 193 ./in.cue:46:6 194 - list:13:9 195 + ./in.cue:46:25 196 + list:10:9 197 t42: invalid list element 0 in argument 0 to call: cannot use value 1 (int) as string: 198 ./in.cue:48:6 199 ./in.cue:48:24 200 @@ -44,9 +45,10 @@ 201 ./in.cue:51:15 202 t49: error in call to list.Take: negative index: 203 ./in.cue:55:6 204 -t54: error in call to list.Sort: 2 errors in empty disjunction:: 205 +t54: error in call to list.Sort: conflicting values *adt.BasicType and *adt.StructLit (mismatched types number and struct): 206 ./in.cue:60:6 207 - list:13:9 208 + ./in.cue:60:25 209 + list:10:9 210 211 Result: 212 t1: 2.5 213 @@ -97,7 +99,7 @@ 214 a: 2 215 v: 1 216 }] 217 -t40: _|_ // t40: error in call to list.Sort: Ascending.x: 2 errors in empty disjunction: 218 +t40: _|_ // t40: error in call to list.Sort: Ascending.x: conflicting values *adt.BasicType and *adt.StructLit (mismatched types number and struct) 219 t41: ["a", "b"] 220 t42: _|_ // t42: invalid list element 0 in argument 0 to call: cannot use value 1 (int) as string 221 t43: 10 222 @@ -111,5 +113,5 @@ 223 t51: false 224 t52: true 225 t53: false 226 -t54: _|_ // t54: error in call to list.Sort: Ascending.x: 2 errors in empty disjunction: 227 +t54: _|_ // t54: error in call to list.Sort: Ascending.x: conflicting values *adt.BasicType and *adt.StructLit (mismatched types number and struct) 228 t55: 8 229 -- diff/todo/p2 -- 230 Missing empty disjunction error. 231 -- out/list -- 232 Errors: 233 t2: error in call to list.Avg: empty list: 234 ./in.cue:4:6 235 t3: cannot use "foo" (type string) as list in argument 1 to list.Avg: 236 ./in.cue:5:15 237 t7: error in call to list.Drop: negative index: 238 ./in.cue:9:6 239 t13: error in call to list.FlattenN: cannot use value "foo" (type string) as list: 240 ./in.cue:15:6 241 ./in.cue:15:20 242 t14: cannot use "foo" (type string) as int in argument 2 to list.FlattenN: 243 ./in.cue:16:24 244 t16: error in call to list.Max: empty list: 245 ./in.cue:18:6 246 t17: cannot use "foo" (type string) as list in argument 1 to list.Max: 247 ./in.cue:19:15 248 t19: error in call to list.Min: empty list: 249 ./in.cue:21:6 250 t20: cannot use "foo" (type string) as list in argument 1 to list.Min: 251 ./in.cue:22:15 252 t23: cannot use "foo" (type string) as list in argument 1 to list.Product: 253 ./in.cue:25:19 254 t24: error in call to list.Range: step must be non zero: 255 ./in.cue:26:6 256 t25: error in call to list.Range: end must be greater than start when step is positive: 257 ./in.cue:27:6 258 t26: error in call to list.Range: end must be less than start when step is negative: 259 ./in.cue:28:6 260 t33: error in call to list.Slice: negative index: 261 ./in.cue:35:6 262 t34: error in call to list.Slice: invalid index: 3 > 1: 263 ./in.cue:36:6 264 t35: error in call to list.Slice: slice bounds out of range: 265 ./in.cue:37:6 266 t36: error in call to list.Slice: slice bounds out of range: 267 ./in.cue:38:6 268 t40: error in call to list.Sort: 2 errors in empty disjunction:: 269 ./in.cue:46:6 270 list:13:9 271 t42: invalid list element 0 in argument 0 to call: cannot use value 1 (int) as string: 272 ./in.cue:48:6 273 ./in.cue:48:24 274 t45: cannot use "foo" (type string) as list in argument 1 to list.Sum: 275 ./in.cue:51:15 276 t49: error in call to list.Take: negative index: 277 ./in.cue:55:6 278 t54: error in call to list.Sort: 2 errors in empty disjunction:: 279 ./in.cue:60:6 280 list:13:9 281 282 Result: 283 t1: 2.5 284 t2: _|_ // t2: error in call to list.Avg: empty list 285 t3: _|_ // t3: cannot use "foo" (type string) as list in argument 1 to list.Avg 286 t4: [1, 2, 3, 4] 287 t5: [3, 4] 288 t6: [] 289 t7: _|_ // t7: error in call to list.Drop: negative index 290 t8: [1, 2, 3, 4] 291 t9: [1, [[2, 3], []], [4]] 292 t10: [1, [2, 3], [], 4] 293 t11: [1, 2, 3, 4] 294 t12: [] 295 t13: _|_ // t13: error in call to list.FlattenN: cannot use value "foo" (type string) as list 296 t14: _|_ // t14: cannot use "foo" (type string) as int in argument 2 to list.FlattenN 297 t15: 4 298 t16: _|_ // t16: error in call to list.Max: empty list 299 t17: _|_ // t17: cannot use "foo" (type string) as list in argument 1 to list.Max 300 t18: 1 301 t19: _|_ // t19: error in call to list.Min: empty list 302 t20: _|_ // t20: cannot use "foo" (type string) as list in argument 1 to list.Min 303 t21: 24 304 t22: 1 305 t23: _|_ // t23: cannot use "foo" (type string) as list in argument 1 to list.Product 306 t24: _|_ // t24: error in call to list.Range: step must be non zero 307 t25: _|_ // t25: error in call to list.Range: end must be greater than start when step is positive 308 t26: _|_ // t26: error in call to list.Range: end must be less than start when step is negative 309 t27: [0, 1, 2, 3, 4] 310 t28: [0] 311 t29: [0, 2, 4] 312 t30: [5, 4, 3, 2, 1] 313 t31: [0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5] 314 t32: [2, 3] 315 t33: _|_ // t33: error in call to list.Slice: negative index 316 t34: _|_ // t34: error in call to list.Slice: invalid index: 3 > 1 317 t35: _|_ // t35: error in call to list.Slice: slice bounds out of range 318 t36: _|_ // t36: error in call to list.Slice: slice bounds out of range 319 t37: [] 320 t38: [1, 2, 3, 4] 321 t39: [{ 322 a: 1 323 v: 2 324 }, { 325 a: 1 326 v: 3 327 }, { 328 a: 2 329 v: 1 330 }] 331 t40: _|_ // t40: error in call to list.Sort: Ascending.x: 2 errors in empty disjunction: 332 t41: ["a", "b"] 333 t42: _|_ // t42: invalid list element 0 in argument 0 to call: cannot use value 1 (int) as string 334 t43: 10 335 t44: 0 336 t45: _|_ // t45: cannot use "foo" (type string) as list in argument 1 to list.Sum 337 t46: [] 338 t47: [1, 2] 339 t48: [1, 2, 3, 4] 340 t49: _|_ // t49: error in call to list.Take: negative index 341 t50: true 342 t51: false 343 t52: true 344 t53: false 345 t54: _|_ // t54: error in call to list.Sort: Ascending.x: 2 errors in empty disjunction: 346 t55: 8