...

Text file src/cuelang.org/go/cue/testdata/basicrewrite/011_list_arithmetic.txtar

Documentation: cuelang.org/go/cue/testdata/basicrewrite

     1# DO NOT EDIT; generated by go run testdata/gen.go
     2#
     3#name: list arithmetic
     4#evalPartial
     5-- in.cue --
     6list: [1, 2, 3]
     7mul0: list * 0
     8mul1: list * 1
     9mul2: 2 * list
    10list1: [1]
    11mul1_0: list1 * 0
    12mul1_1: 1 * list1
    13mul1_2: list1 * 2
    14add1_2: list + list1
    15e:      list * -1
    16-- out/def --
    17list: [1, 2, 3]
    18mul0: []
    19mul1: [1, 2, 3]
    20mul2: [1, 2, 3, 1, 2, 3]
    21list1: [1]
    22mul1_0: []
    23mul1_1: [1]
    24mul1_2: [1, 1]
    25e: _|_ // negative number -1 multiplies list
    26-- out/legacy-debug --
    27<0>{list: [1,2,3], mul0: [], mul1: [1,2,3], mul2: [1,2,3,1,2,3], list1: [1], mul1_0: [], mul1_1: [1], mul1_2: [1,1], e: _|_((<1>.list * -1):negative number -1 multiplies list)}
    28-- out/compile --
    29--- in.cue
    30{
    31  list: [
    32    1,
    33    2,
    34    3,
    35  ]
    36  mul0: (〈0;list〉 * 0)
    37  mul1: (〈0;list〉 * 1)
    38  mul2: (2 * 〈0;list〉)
    39  list1: [
    40    1,
    41  ]
    42  mul1_0: (〈0;list1〉 * 0)
    43  mul1_1: (1 * 〈0;list1〉)
    44  mul1_2: (〈0;list1〉 * 2)
    45  add1_2: (〈0;list〉 + 〈0;list1〉)
    46  e: (〈0;list〉 * -1)
    47}
    48-- out/eval/stats --
    49Leaks:  7
    50Freed:  31
    51Reused: 28
    52Allocs: 10
    53Retain: 7
    54
    55Unifications: 38
    56Conjuncts:    77
    57Disjuncts:    38
    58-- out/eval --
    59Errors:
    60e: cannot convert negative number to uint64:
    61    ./in.cue:10:9
    62
    63Result:
    64(_|_){
    65  // [eval]
    66  list: (#list){
    67    0: (int){ 1 }
    68    1: (int){ 2 }
    69    2: (int){ 3 }
    70  }
    71  mul0: (#list){
    72  }
    73  mul1: (#list){
    74    0: (int){ 1 }
    75    1: (int){ 2 }
    76    2: (int){ 3 }
    77  }
    78  mul2: (#list){
    79    0: (int){ 1 }
    80    1: (int){ 2 }
    81    2: (int){ 3 }
    82    3: (int){ 1 }
    83    4: (int){ 2 }
    84    5: (int){ 3 }
    85  }
    86  list1: (#list){
    87    0: (int){ 1 }
    88  }
    89  mul1_0: (#list){
    90  }
    91  mul1_1: (#list){
    92    0: (int){ 1 }
    93  }
    94  mul1_2: (#list){
    95    0: (int){ 1 }
    96    1: (int){ 1 }
    97  }
    98  add1_2: (#list){
    99    0: (int){ 1 }
   100    1: (int){ 2 }
   101    2: (int){ 3 }
   102    3: (int){ 1 }
   103  }
   104  e: (_|_){
   105    // [eval] e: cannot convert negative number to uint64:
   106    //     ./in.cue:10:9
   107  }
   108}

View as plain text