...

Text file src/cuelang.org/go/pkg/list/testdata/gen.txtar

Documentation: cuelang.org/go/pkg/list/testdata

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

View as plain text