github.com/solo-io/cue@v0.4.7/cue/testdata/resolve/011_bounds.txtar (about)

     1  # DO NOT EDIT; generated by go run testdata/gen.go
     2  #
     3  #name: bounds
     4  #evalPartial
     5  -- in.cue --
     6  i1: >1 & 5
     7  i2: (>=0 & <=10) & 5
     8  i3: !=null & []
     9  i4: !=2 & !=4
    10  
    11  s1: >=0 & <=10 & !=1  // no simplification
    12  s2: >=0 & <=10 & !=11 // >=0 & <=10
    13  s3: >5 & !=5          // >5
    14  s4: <10 & !=10        // <10
    15  s5: !=2 & !=2
    16  
    17  // TODO: could change inequality
    18  s6: !=2 & >=2
    19  s7: >=2 & !=2
    20  
    21  s8: !=5 & >5
    22  
    23  s10: >=0 & <=10 & <12 & >1 // >1  & <=10
    24  s11: >0 & >=0 & <=12 & <12 // >0  & <12
    25  
    26  s20: >=10 & <=10 // 10
    27  
    28  s22:  >5 & <=6         // no simplification
    29  s22a: >5 & (<=6 & int) // 6
    30  s22b: (int & >5) & <=6 // 6
    31  s22c: >=5 & (<6 & int) // 5
    32  s22d: (int & >=5) & <6 // 5
    33  s22e: (>=5 & <6) & int // 5
    34  s22f: int & (>=5 & <6) // 5
    35  
    36  s23:  >0 & <2         // no simplification
    37  s23a: (>0 & <2) & int // int & 1
    38  s23b: int & (>0 & <2) // int & 1
    39  s23c: (int & >0) & <2 // int & 1
    40  s23d: >0 & (int & <2) // int & 1
    41  s23e: >0.0 & <2.0     // no simplification
    42  
    43  s30: >0 & int
    44  
    45  e1: null & !=null
    46  e2: !=null & null
    47  e3: >1 & 1
    48  e4: <0 & 0
    49  e5: >1 & <0
    50  e6: >11 & <11
    51  e7: >=11 & <11
    52  e8: >11 & <=11
    53  e9: >"a" & <1
    54  -- out/def --
    55  i1: 5
    56  i2: 5
    57  i3: []
    58  i4: !=2 & !=4
    59  s1: >=0 & <=10 & !=1
    60  s2: >=0 & <=10
    61  s3: >5
    62  s4: <10
    63  s5: !=2
    64  
    65  // TODO: could change inequality
    66  s6:   !=2
    67  s7:   !=2
    68  s8:   >5
    69  s10:  >1 & <=10
    70  s11:  >0 & <12
    71  s20:  10
    72  s22:  >5 & <=6
    73  s22a: 6
    74  s22b: 6
    75  s22c: 5
    76  s22d: 5
    77  s22e: 5
    78  s22f: 5
    79  s23:  >0 & <2
    80  s23a: 1
    81  s23b: 1
    82  s23c: 1
    83  s23d: 1
    84  s23e: >0.0 & <2.0
    85  s30:  >0
    86  e1:   _|_ // invalid value null (excluded by !=null)
    87  e2:   _|_ // invalid value null (excluded by !=null)
    88  e3:   _|_ // invalid value 1 (out of bound >1)
    89  e4:   _|_ // invalid value 0 (out of bound <0)
    90  e5:   _|_ // conflicting bounds >1 and <0
    91  e6:   _|_ // conflicting bounds >11 and <11
    92  e7:   _|_ // conflicting bounds >=11 and <11
    93  e8:   _|_ // conflicting bounds >11 and <=11
    94  e9:   _|_ // conflicting values >"a" and <1 (mismatched types string and number)
    95  -- out/legacy-debug --
    96  <0>{i1: 5, i2: 5, i3: [], i4: (!=2 & !=4), s1: (>=0 & <=10 & !=1), s2: (>=0 & <=10), s3: >5, s4: <10, s5: !=2, s6: (!=2 & >=2), s7: (>=2 & !=2), s8: >5, s10: (<=10 & >1), s11: (>0 & <12), s20: 10, s22: (>5 & <=6), s22a: 6, s22b: 6, s22c: 5, s22d: 5, s22e: 5, s22f: 5, s23: (>0 & <2), s23a: 1, s23b: 1, s23c: 1, s23d: 1, s23e: (>0.0 & <2.0), s30: int & >0, e1: _|_((!=null & null):invalid value null (excluded by !=null)), e2: _|_((!=null & null):invalid value null (excluded by !=null)), e3: _|_((>1 & 1):invalid value 1 (out of bound >1)), e4: _|_((<0 & 0):invalid value 0 (out of bound <0)), e5: _|_(conflicting bounds >1 and <0), e6: _|_(conflicting bounds >11 and <11), e7: _|_(conflicting bounds >=11 and <11), e8: _|_(conflicting bounds >11 and <=11), e9: _|_((>"a" & <1):conflicting values >"a" and <1 (mismatched types string and number))}
    97  -- out/compile --
    98  --- in.cue
    99  {
   100    i1: (>1 & 5)
   101    i2: ((>=0 & <=10) & 5)
   102    i3: (!=null & [])
   103    i4: (!=2 & !=4)
   104    s1: ((>=0 & <=10) & !=1)
   105    s2: ((>=0 & <=10) & !=11)
   106    s3: (>5 & !=5)
   107    s4: (<10 & !=10)
   108    s5: (!=2 & !=2)
   109    s6: (!=2 & >=2)
   110    s7: (>=2 & !=2)
   111    s8: (!=5 & >5)
   112    s10: (((>=0 & <=10) & <12) & >1)
   113    s11: (((>0 & >=0) & <=12) & <12)
   114    s20: (>=10 & <=10)
   115    s22: (>5 & <=6)
   116    s22a: (>5 & (<=6 & int))
   117    s22b: ((int & >5) & <=6)
   118    s22c: (>=5 & (<6 & int))
   119    s22d: ((int & >=5) & <6)
   120    s22e: ((>=5 & <6) & int)
   121    s22f: (int & (>=5 & <6))
   122    s23: (>0 & <2)
   123    s23a: ((>0 & <2) & int)
   124    s23b: (int & (>0 & <2))
   125    s23c: ((int & >0) & <2)
   126    s23d: (>0 & (int & <2))
   127    s23e: (>0.0 & <2.0)
   128    s30: (>0 & int)
   129    e1: (null & !=null)
   130    e2: (!=null & null)
   131    e3: (>1 & 1)
   132    e4: (<0 & 0)
   133    e5: (>1 & <0)
   134    e6: (>11 & <11)
   135    e7: (>=11 & <11)
   136    e8: (>11 & <=11)
   137    e9: (>"a" & <1)
   138  }
   139  -- out/eval --
   140  Errors:
   141  e1: conflicting values null and !=null (mismatched types null and (bool|string|bytes|func|list|struct|number)):
   142      ./in.cue:40:5
   143      ./in.cue:40:12
   144  e2: conflicting values !=null and null (mismatched types (bool|string|bytes|func|list|struct|number) and null):
   145      ./in.cue:41:5
   146      ./in.cue:41:14
   147  e5: incompatible bounds >1 and <0:
   148      ./in.cue:44:5
   149      ./in.cue:44:10
   150  e6: incompatible bounds >11 and <11:
   151      ./in.cue:45:5
   152      ./in.cue:45:11
   153  e7: incompatible bounds >=11 and <11:
   154      ./in.cue:46:5
   155      ./in.cue:46:12
   156  e8: incompatible bounds >11 and <=11:
   157      ./in.cue:47:5
   158      ./in.cue:47:11
   159  e9: conflicting values >"a" and <1 (mismatched types string and number):
   160      ./in.cue:48:5
   161      ./in.cue:48:12
   162  e3: invalid value 1 (out of bound >1):
   163      ./in.cue:42:5
   164      ./in.cue:42:10
   165  e4: invalid value 0 (out of bound <0):
   166      ./in.cue:43:5
   167      ./in.cue:43:10
   168  
   169  Result:
   170  (_|_){
   171    // [eval]
   172    i1: (int){ 5 }
   173    i2: (int){ 5 }
   174    i3: (#list){
   175    }
   176    i4: (number){ &(!=2, !=4) }
   177    s1: (number){ &(>=0, <=10, !=1) }
   178    s2: (number){ &(>=0, <=10) }
   179    s3: (number){ >5 }
   180    s4: (number){ <10 }
   181    s5: (number){ !=2 }
   182    s6: (number){ &(>=2, !=2) }
   183    s7: (number){ &(>=2, !=2) }
   184    s8: (number){ >5 }
   185    s10: (number){ &(>1, <=10) }
   186    s11: (number){ &(>0, <12) }
   187    s20: (number){ 10 }
   188    s22: (number){ &(>5, <=6) }
   189    s22a: (int){ 6 }
   190    s22b: (int){ 6 }
   191    s22c: (int){ 5 }
   192    s22d: (int){ 5 }
   193    s22e: (int){ 5 }
   194    s22f: (int){ 5 }
   195    s23: (number){ &(>0, <2) }
   196    s23a: (int){ 1 }
   197    s23b: (int){ 1 }
   198    s23c: (int){ 1 }
   199    s23d: (int){ 1 }
   200    s23e: (number){ &(>0.0, <2.0) }
   201    s30: (int){ &(>0, int) }
   202    e1: (_|_){
   203      // [eval] e1: conflicting values null and !=null (mismatched types null and (bool|string|bytes|func|list|struct|number)):
   204      //     ./in.cue:40:5
   205      //     ./in.cue:40:12
   206    }
   207    e2: (_|_){
   208      // [eval] e2: conflicting values !=null and null (mismatched types (bool|string|bytes|func|list|struct|number) and null):
   209      //     ./in.cue:41:5
   210      //     ./in.cue:41:14
   211    }
   212    e3: (_|_){
   213      // [eval] e3: invalid value 1 (out of bound >1):
   214      //     ./in.cue:42:5
   215      //     ./in.cue:42:10
   216    }
   217    e4: (_|_){
   218      // [eval] e4: invalid value 0 (out of bound <0):
   219      //     ./in.cue:43:5
   220      //     ./in.cue:43:10
   221    }
   222    e5: (_|_){
   223      // [eval] e5: incompatible bounds >1 and <0:
   224      //     ./in.cue:44:5
   225      //     ./in.cue:44:10
   226    }
   227    e6: (_|_){
   228      // [eval] e6: incompatible bounds >11 and <11:
   229      //     ./in.cue:45:5
   230      //     ./in.cue:45:11
   231    }
   232    e7: (_|_){
   233      // [eval] e7: incompatible bounds >=11 and <11:
   234      //     ./in.cue:46:5
   235      //     ./in.cue:46:12
   236    }
   237    e8: (_|_){
   238      // [eval] e8: incompatible bounds >11 and <=11:
   239      //     ./in.cue:47:5
   240      //     ./in.cue:47:11
   241    }
   242    e9: (_|_){
   243      // [eval] e9: conflicting values >"a" and <1 (mismatched types string and number):
   244      //     ./in.cue:48:5
   245      //     ./in.cue:48:12
   246    }
   247  }