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

     1  # DO NOT EDIT; generated by go run testdata/gen.go
     2  #
     3  #name: range unification
     4  #evalPartial
     5  -- in.cue --
     6  	// with concrete values
     7  a1: >=1 & <=5 & 3
     8  a2: >=1 & <=5 & 1
     9  a3: >=1 & <=5 & 5
    10  a4: >=1 & <=5 & 6
    11  a5: >=1 & <=5 & 0
    12  
    13  a6:  3 & >=1 & <=5
    14  a7:  1 & >=1 & <=5
    15  a8:  5 & >=1 & <=5
    16  a9:  6 & >=1 & <=5
    17  a10: 0 & >=1 & <=5
    18  
    19  // with ranges
    20  b1: >=1 & <=5 & >=1 & <=5
    21  b2: >=1 & <=5 & >=1 & <=1
    22  b3: >=1 & <=5 & >=5 & <=5
    23  b4: >=1 & <=5 & >=2 & <=3
    24  b5: >=1 & <=5 & >=3 & <=9
    25  b6: >=1 & <=5 & >=5 & <=9
    26  b7: >=1 & <=5 & >=6 & <=9
    27  
    28  b8:  >=1 & <=5 & >=1 & <=5
    29  b9:  >=1 & <=1 & >=1 & <=5
    30  b10: >=5 & <=5 & >=1 & <=5
    31  b11: >=2 & <=3 & >=1 & <=5
    32  b12: >=3 & <=9 & >=1 & <=5
    33  b13: >=5 & <=9 & >=1 & <=5
    34  b14: >=6 & <=9 & >=1 & <=5
    35  
    36  // ranges with more general types
    37  c1: int & >=1 & <=5
    38  c2: >=1 & <=5 & int
    39  c3: string & >=1 & <=5
    40  c4: >=1 & <=5 & string
    41  
    42  // other types
    43  s1: >="d" & <="z" & "e"
    44  s2: >="d" & <="z" & "ee"
    45  
    46  n1: number & >=1 & <=2
    47  n2: int & >=1.1 & <=1.3
    48  n3: >=1.0 & <=3.0 & 2
    49  n4: >=0.0 & <=0.1 & 0.09999
    50  n5: >=1 & <=5 & 2.5
    51  -- out/def --
    52  	// with concrete values
    53  a1:  3
    54  a2:  1
    55  a3:  5
    56  a4:  _|_ // invalid value 6 (out of bound <=5)
    57  a5:  _|_ // invalid value 0 (out of bound >=1)
    58  a6:  3
    59  a7:  1
    60  a8:  5
    61  a9:  _|_ // invalid value 6 (out of bound <=5)
    62  a10: _|_ // invalid value 0 (out of bound >=1)
    63  
    64  // with ranges
    65  b1:  >=1 & <=5
    66  b2:  1
    67  b3:  5
    68  b4:  >=2 & <=3
    69  b5:  >=3 & <=5
    70  b6:  5
    71  b7:  _|_ // conflicting bounds >=6 and <=5
    72  b8:  >=1 & <=5
    73  b9:  1
    74  b10: 5
    75  b11: >=2 & <=3
    76  b12: >=3 & <=5
    77  b13: 5
    78  b14: _|_ // conflicting bounds >=6 and <=5
    79  
    80  // ranges with more general types
    81  c1: uint & >=1 & <=5
    82  c2: uint & >=1 & <=5
    83  c3: _|_ // conflicting values string and >=1 (mismatched types string and number)
    84  c4: _|_ // conflicting values (>=1 & <=5) and string (mismatched types number and string)
    85  
    86  // other types
    87  s1: "e"
    88  s2: "ee"
    89  n1: >=1 & <=2
    90  n2: _|_ // conflicting bounds int & >=1.1 and <=1.3
    91  n3: 2
    92  n4: 0.09999
    93  n5: 2.5
    94  -- out/legacy-debug --
    95  <0>{a1: 3, a2: 1, a3: 5, a4: _|_((<=5 & 6):invalid value 6 (out of bound <=5)), a5: _|_((>=1 & 0):invalid value 0 (out of bound >=1)), a6: 3, a7: 1, a8: 5, a9: _|_((<=5 & 6):invalid value 6 (out of bound <=5)), a10: _|_((>=1 & 0):invalid value 0 (out of bound >=1)), b1: (>=1 & <=5), b2: 1, b3: 5, b4: (>=2 & <=3), b5: (>=3 & <=5), b6: 5, b7: _|_(conflicting bounds >=6 and <=5), b8: (>=1 & <=5), b9: 1, b10: 5, b11: (>=2 & <=3), b12: (>=3 & <=5), b13: 5, b14: _|_(conflicting bounds >=6 and <=5), c1: (int & >=1 & <=5), c2: (<=5 & int & >=1), c3: _|_((string & >=1):conflicting values string and >=1 (mismatched types string and number)), c4: _|_(((>=1 & <=5) & string):conflicting values (>=1 & <=5) and string (mismatched types number and string)), s1: "e", s2: "ee", n1: (>=1 & <=2), n2: _|_(conflicting bounds int & >=1.1 and <=1.3), n3: 2, n4: 0.09999, n5: 2.5}
    96  -- out/compile --
    97  --- in.cue
    98  {
    99    a1: ((>=1 & <=5) & 3)
   100    a2: ((>=1 & <=5) & 1)
   101    a3: ((>=1 & <=5) & 5)
   102    a4: ((>=1 & <=5) & 6)
   103    a5: ((>=1 & <=5) & 0)
   104    a6: ((3 & >=1) & <=5)
   105    a7: ((1 & >=1) & <=5)
   106    a8: ((5 & >=1) & <=5)
   107    a9: ((6 & >=1) & <=5)
   108    a10: ((0 & >=1) & <=5)
   109    b1: (((>=1 & <=5) & >=1) & <=5)
   110    b2: (((>=1 & <=5) & >=1) & <=1)
   111    b3: (((>=1 & <=5) & >=5) & <=5)
   112    b4: (((>=1 & <=5) & >=2) & <=3)
   113    b5: (((>=1 & <=5) & >=3) & <=9)
   114    b6: (((>=1 & <=5) & >=5) & <=9)
   115    b7: (((>=1 & <=5) & >=6) & <=9)
   116    b8: (((>=1 & <=5) & >=1) & <=5)
   117    b9: (((>=1 & <=1) & >=1) & <=5)
   118    b10: (((>=5 & <=5) & >=1) & <=5)
   119    b11: (((>=2 & <=3) & >=1) & <=5)
   120    b12: (((>=3 & <=9) & >=1) & <=5)
   121    b13: (((>=5 & <=9) & >=1) & <=5)
   122    b14: (((>=6 & <=9) & >=1) & <=5)
   123    c1: ((int & >=1) & <=5)
   124    c2: ((>=1 & <=5) & int)
   125    c3: ((string & >=1) & <=5)
   126    c4: ((>=1 & <=5) & string)
   127    s1: ((>="d" & <="z") & "e")
   128    s2: ((>="d" & <="z") & "ee")
   129    n1: ((number & >=1) & <=2)
   130    n2: ((int & >=1.1) & <=1.3)
   131    n3: ((>=1.0 & <=3.0) & 2)
   132    n4: ((>=0.0 & <=0.1) & 0.09999)
   133    n5: ((>=1 & <=5) & 2.5)
   134  }
   135  -- out/eval --
   136  Errors:
   137  b14: incompatible bounds >=6 and <=5:
   138      ./in.cue:29:6
   139      ./in.cue:29:24
   140  b7: incompatible bounds >=6 and <=5:
   141      ./in.cue:21:11
   142      ./in.cue:21:17
   143  c3: conflicting values string and >=1 (mismatched types string and number):
   144      ./in.cue:34:5
   145      ./in.cue:34:14
   146  c4: conflicting values >=1 and string (mismatched types number and string):
   147      ./in.cue:35:5
   148      ./in.cue:35:17
   149  n2: incompatible bounds >=1.1 and <=1.3:
   150      ./in.cue:42:11
   151      ./in.cue:42:19
   152  a4: invalid value 6 (out of bound <=5):
   153      ./in.cue:5:11
   154      ./in.cue:5:17
   155  a5: invalid value 0 (out of bound >=1):
   156      ./in.cue:6:5
   157      ./in.cue:6:17
   158  a9: invalid value 6 (out of bound <=5):
   159      ./in.cue:11:16
   160      ./in.cue:11:6
   161  a10: invalid value 0 (out of bound >=1):
   162      ./in.cue:12:10
   163      ./in.cue:12:6
   164  
   165  Result:
   166  (_|_){
   167    // [eval]
   168    a1: (int){ 3 }
   169    a2: (int){ 1 }
   170    a3: (int){ 5 }
   171    a4: (_|_){
   172      // [eval] a4: invalid value 6 (out of bound <=5):
   173      //     ./in.cue:5:11
   174      //     ./in.cue:5:17
   175    }
   176    a5: (_|_){
   177      // [eval] a5: invalid value 0 (out of bound >=1):
   178      //     ./in.cue:6:5
   179      //     ./in.cue:6:17
   180    }
   181    a6: (int){ 3 }
   182    a7: (int){ 1 }
   183    a8: (int){ 5 }
   184    a9: (_|_){
   185      // [eval] a9: invalid value 6 (out of bound <=5):
   186      //     ./in.cue:11:16
   187      //     ./in.cue:11:6
   188    }
   189    a10: (_|_){
   190      // [eval] a10: invalid value 0 (out of bound >=1):
   191      //     ./in.cue:12:10
   192      //     ./in.cue:12:6
   193    }
   194    b1: (number){ &(>=1, <=5) }
   195    b2: (number){ 1 }
   196    b3: (number){ 5 }
   197    b4: (number){ &(>=2, <=3) }
   198    b5: (number){ &(>=3, <=5) }
   199    b6: (number){ 5 }
   200    b7: (_|_){
   201      // [eval] b7: incompatible bounds >=6 and <=5:
   202      //     ./in.cue:21:11
   203      //     ./in.cue:21:17
   204    }
   205    b8: (number){ &(>=1, <=5) }
   206    b9: (number){ 1 }
   207    b10: (number){ 5 }
   208    b11: (number){ &(>=2, <=3) }
   209    b12: (number){ &(>=3, <=5) }
   210    b13: (number){ 5 }
   211    b14: (_|_){
   212      // [eval] b14: incompatible bounds >=6 and <=5:
   213      //     ./in.cue:29:6
   214      //     ./in.cue:29:24
   215    }
   216    c1: (int){ &(>=1, <=5, int) }
   217    c2: (int){ &(>=1, <=5, int) }
   218    c3: (_|_){
   219      // [eval] c3: conflicting values string and >=1 (mismatched types string and number):
   220      //     ./in.cue:34:5
   221      //     ./in.cue:34:14
   222    }
   223    c4: (_|_){
   224      // [eval] c4: conflicting values >=1 and string (mismatched types number and string):
   225      //     ./in.cue:35:5
   226      //     ./in.cue:35:17
   227    }
   228    s1: (string){ "e" }
   229    s2: (string){ "ee" }
   230    n1: (number){ &(>=1, <=2) }
   231    n2: (_|_){
   232      // [eval] n2: incompatible bounds >=1.1 and <=1.3:
   233      //     ./in.cue:42:11
   234      //     ./in.cue:42:19
   235    }
   236    n3: (int){ 2 }
   237    n4: (float){ 0.09999 }
   238    n5: (float){ 2.5 }
   239  }