cuelang.org/go@v0.13.0/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 --
    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: 2 errors in empty disjunction::
   103      ./in.cue:46:6
   104      list:13:9
   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  t49: error in call to list.Take: negative index:
   111      ./in.cue:55:6
   112  t54: error in call to list.Sort: 2 errors in empty disjunction::
   113      ./in.cue:60:6
   114      list:13:9
   115  
   116  Result:
   117  t1: 2.5
   118  t2: _|_ // t2: error in call to list.Avg: empty list
   119  t3: _|_ // t3: cannot use "foo" (type string) as list in argument 1 to list.Avg
   120  t4: [1, 2, 3, 4]
   121  t5: [3, 4]
   122  t6: []
   123  t7: _|_ // t7: error in call to list.Drop: negative index
   124  t8: [1, 2, 3, 4]
   125  t9: [1, [[2, 3], []], [4]]
   126  t10: [1, [2, 3], [], 4]
   127  t11: [1, 2, 3, 4]
   128  t12: []
   129  t13: _|_ // t13: error in call to list.FlattenN: cannot use value "foo" (type string) as list
   130  t14: _|_ // t14: cannot use "foo" (type string) as int in argument 2 to list.FlattenN
   131  t15: 4
   132  t16: _|_ // t16: error in call to list.Max: empty list
   133  t17: _|_ // t17: cannot use "foo" (type string) as list in argument 1 to list.Max
   134  t18: 1
   135  t19: _|_ // t19: error in call to list.Min: empty list
   136  t20: _|_ // t20: cannot use "foo" (type string) as list in argument 1 to list.Min
   137  t21: 24
   138  t22: 1
   139  t23: _|_ // t23: cannot use "foo" (type string) as list in argument 1 to list.Product
   140  t24: _|_ // t24: error in call to list.Range: step must be non zero
   141  t25: _|_ // t25: error in call to list.Range: end must be greater than start when step is positive
   142  t26: _|_ // t26: error in call to list.Range: end must be less than start when step is negative
   143  t27: [0, 1, 2, 3, 4]
   144  t28: [0]
   145  t29: [0, 2, 4]
   146  t30: [5, 4, 3, 2, 1]
   147  t31: [0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5]
   148  t32: [2, 3]
   149  t33: _|_ // t33: error in call to list.Slice: negative index
   150  t34: _|_ // t34: error in call to list.Slice: invalid index: 3 > 1
   151  t35: _|_ // t35: error in call to list.Slice: slice bounds out of range
   152  t36: _|_ // t36: error in call to list.Slice: slice bounds out of range
   153  t37: []
   154  t38: [1, 2, 3, 4]
   155  t39: [{
   156  	a: 1
   157  	v: 2
   158  }, {
   159  	a: 1
   160  	v: 3
   161  }, {
   162  	a: 2
   163  	v: 1
   164  }]
   165  t40: _|_ // t40: error in call to list.Sort: Ascending.x: 2 errors in empty disjunction: (and 5 more errors)
   166  t41: ["a", "b"]
   167  t42: _|_ // t42: invalid list element 0 in argument 0 to call: cannot use value 1 (int) as string
   168  t43: 10
   169  t44: 0
   170  t45: _|_ // t45: cannot use "foo" (type string) as list in argument 1 to list.Sum
   171  t46: []
   172  t47: [1, 2]
   173  t48: [1, 2, 3, 4]
   174  t49: _|_ // t49: error in call to list.Take: negative index
   175  t50: true
   176  t51: false
   177  t52: true
   178  t53: false
   179  t54: _|_ // t54: error in call to list.Sort: Ascending.x: 2 errors in empty disjunction: (and 5 more errors)
   180  t55: 8