cuelang.org/go@v0.13.0/cue/testdata/basicrewrite/016_comparison.txtar (about)

     1  #name: comparison
     2  #evalPartial
     3  -- in.cue --
     4  lss: 1 < 2
     5  leq: 1 <= 1.0
     6  leq: 2.0 <= 3
     7  eql: 1 == 1.0
     8  neq: 1.0 == 1
     9  gtr: !(2 > 3)
    10  geq: 2.0 >= 2
    11  seq: "a"+"b" == "ab"
    12  err: 2 == "s"
    13  -- out/def --
    14  lss: true
    15  leq: true
    16  eql: true
    17  neq: true
    18  gtr: true
    19  geq: true
    20  seq: true
    21  err: _|_ // invalid operation 2 == "s" (mismatched types int and string)
    22  -- out/legacy-debug --
    23  <0>{lss: true, leq: true, eql: true, neq: true, gtr: true, geq: true, seq: true, err: _|_((2 == "s"):invalid operation 2 == "s" (mismatched types int and string))}
    24  -- out/compile --
    25  --- in.cue
    26  {
    27    lss: (1 < 2)
    28    leq: (1 <= 1.0)
    29    leq: (2.0 <= 3)
    30    eql: (1 == 1.0)
    31    neq: (1.0 == 1)
    32    gtr: !(2 > 3)
    33    geq: (2.0 >= 2)
    34    seq: (("a" + "b") == "ab")
    35    err: (2 == "s")
    36  }
    37  -- out/eval/stats --
    38  Leaks:  0
    39  Freed:  9
    40  Reused: 7
    41  Allocs: 2
    42  Retain: 0
    43  
    44  Unifications: 9
    45  Conjuncts:    10
    46  Disjuncts:    9
    47  -- out/eval --
    48  Errors:
    49  err: invalid operands 2 and "s" to '==' (type int and string):
    50      ./in.cue:9:6
    51      ./in.cue:9:11
    52  
    53  Result:
    54  (_|_){
    55    // [eval]
    56    lss: (bool){ true }
    57    leq: (bool){ true }
    58    eql: (bool){ true }
    59    neq: (bool){ true }
    60    gtr: (bool){ true }
    61    geq: (bool){ true }
    62    seq: (bool){ true }
    63    err: (_|_){
    64      // [eval] err: invalid operands 2 and "s" to '==' (type int and string):
    65      //     ./in.cue:9:6
    66      //     ./in.cue:9:11
    67    }
    68  }