...

Text file src/cuelang.org/go/cue/testdata/basicrewrite/003_integer-specific_arithmetic.txtar

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

     1# DO NOT EDIT; generated by go run testdata/gen.go
     2#
     3#name: integer-specific arithmetic
     4#evalPartial
     5-- in.cue --
     6q1:  5 quo 2   // 2
     7q2:  5 quo -2  // -2
     8q3:  -5 quo 2  // -2
     9q4:  -5 quo -2 // 2
    10qe1: 2.0 quo 1
    11qe2: 2 quo 1.0
    12
    13r1:  5 rem 2   // 1
    14r2:  5 rem -2  // 1
    15r3:  -5 rem 2  // -1
    16r4:  -5 rem -2 // -1
    17re1: 2.0 rem 1
    18re2: 2 rem 1.0
    19
    20d1:  5 div 2   // 2
    21d2:  5 div -2  // -2
    22d3:  -5 div 2  // -3
    23d4:  -5 div -2 // 3
    24de1: 2.0 div 1
    25de2: 2 div 1.0
    26
    27m1:  5 mod 2   // 1
    28m2:  5 mod -2  // 1
    29m3:  -5 mod 2  // 1
    30m4:  -5 mod -2 // 1
    31me1: 2.0 mod 1
    32me2: 2 mod 1.0
    33-- out/def --
    34q1:  2
    35q2:  -2
    36q3:  -2
    37q4:  2
    38qe1: _|_ // invalid operation 2.0 quo 1 (mismatched types float and int)
    39qe2: _|_ // invalid operation 2 quo 1.0 (mismatched types int and float)
    40r1:  1
    41r2:  1
    42r3:  -1
    43r4:  -1
    44re1: _|_ // invalid operation 2.0 rem 1 (mismatched types float and int)
    45re2: _|_ // invalid operation 2 rem 1.0 (mismatched types int and float)
    46d1:  2
    47d2:  -2
    48d3:  -3
    49d4:  3
    50de1: _|_ // invalid operation 2.0 div 1 (mismatched types float and int)
    51de2: _|_ // invalid operation 2 div 1.0 (mismatched types int and float)
    52m1:  1
    53m2:  1
    54m3:  1
    55m4:  1
    56me1: _|_ // invalid operation 2.0 mod 1 (mismatched types float and int)
    57me2: _|_ // invalid operation 2 mod 1.0 (mismatched types int and float)
    58-- out/legacy-debug --
    59<0>{q1: 2, q2: -2, q3: -2, q4: 2, qe1: _|_((2.0 quo 1):invalid operation 2.0 quo 1 (mismatched types float and int)), qe2: _|_((2 quo 1.0):invalid operation 2 quo 1.0 (mismatched types int and float)), r1: 1, r2: 1, r3: -1, r4: -1, re1: _|_((2.0 rem 1):invalid operation 2.0 rem 1 (mismatched types float and int)), re2: _|_((2 rem 1.0):invalid operation 2 rem 1.0 (mismatched types int and float)), d1: 2, d2: -2, d3: -3, d4: 3, de1: _|_((2.0 div 1):invalid operation 2.0 div 1 (mismatched types float and int)), de2: _|_((2 div 1.0):invalid operation 2 div 1.0 (mismatched types int and float)), m1: 1, m2: 1, m3: 1, m4: 1, me1: _|_((2.0 mod 1):invalid operation 2.0 mod 1 (mismatched types float and int)), me2: _|_((2 mod 1.0):invalid operation 2 mod 1.0 (mismatched types int and float))}
    60-- out/compile --
    61--- in.cue
    62{
    63  q1: (5 quo 2)
    64  q2: (5 quo -2)
    65  q3: (-5 quo 2)
    66  q4: (-5 quo -2)
    67  qe1: (2.0 quo 1)
    68  qe2: (2 quo 1.0)
    69  r1: (5 rem 2)
    70  r2: (5 rem -2)
    71  r3: (-5 rem 2)
    72  r4: (-5 rem -2)
    73  re1: (2.0 rem 1)
    74  re2: (2 rem 1.0)
    75  d1: (5 div 2)
    76  d2: (5 div -2)
    77  d3: (-5 div 2)
    78  d4: (-5 div -2)
    79  de1: (2.0 div 1)
    80  de2: (2 div 1.0)
    81  m1: (5 mod 2)
    82  m2: (5 mod -2)
    83  m3: (-5 mod 2)
    84  m4: (-5 mod -2)
    85  me1: (2.0 mod 1)
    86  me2: (2 mod 1.0)
    87}
    88-- out/eval/stats --
    89Leaks:  0
    90Freed:  25
    91Reused: 23
    92Allocs: 2
    93Retain: 0
    94
    95Unifications: 25
    96Conjuncts:    25
    97Disjuncts:    25
    98-- out/eval --
    99Errors:
   100qe1: invalid operands 2.0 and 1 to 'quo' (type float and int):
   101    ./in.cue:5:6
   102    ./in.cue:5:14
   103qe2: invalid operands 2 and 1.0 to 'quo' (type int and float):
   104    ./in.cue:6:6
   105    ./in.cue:6:12
   106re1: invalid operands 2.0 and 1 to 'rem' (type float and int):
   107    ./in.cue:12:6
   108    ./in.cue:12:14
   109re2: invalid operands 2 and 1.0 to 'rem' (type int and float):
   110    ./in.cue:13:6
   111    ./in.cue:13:12
   112de1: invalid operands 2.0 and 1 to 'div' (type float and int):
   113    ./in.cue:19:6
   114    ./in.cue:19:14
   115de2: invalid operands 2 and 1.0 to 'div' (type int and float):
   116    ./in.cue:20:6
   117    ./in.cue:20:12
   118me1: invalid operands 2.0 and 1 to 'mod' (type float and int):
   119    ./in.cue:26:6
   120    ./in.cue:26:14
   121me2: invalid operands 2 and 1.0 to 'mod' (type int and float):
   122    ./in.cue:27:6
   123    ./in.cue:27:12
   124
   125Result:
   126(_|_){
   127  // [eval]
   128  q1: (int){ 2 }
   129  q2: (int){ -2 }
   130  q3: (int){ -2 }
   131  q4: (int){ 2 }
   132  qe1: (_|_){
   133    // [eval] qe1: invalid operands 2.0 and 1 to 'quo' (type float and int):
   134    //     ./in.cue:5:6
   135    //     ./in.cue:5:14
   136  }
   137  qe2: (_|_){
   138    // [eval] qe2: invalid operands 2 and 1.0 to 'quo' (type int and float):
   139    //     ./in.cue:6:6
   140    //     ./in.cue:6:12
   141  }
   142  r1: (int){ 1 }
   143  r2: (int){ 1 }
   144  r3: (int){ -1 }
   145  r4: (int){ -1 }
   146  re1: (_|_){
   147    // [eval] re1: invalid operands 2.0 and 1 to 'rem' (type float and int):
   148    //     ./in.cue:12:6
   149    //     ./in.cue:12:14
   150  }
   151  re2: (_|_){
   152    // [eval] re2: invalid operands 2 and 1.0 to 'rem' (type int and float):
   153    //     ./in.cue:13:6
   154    //     ./in.cue:13:12
   155  }
   156  d1: (int){ 2 }
   157  d2: (int){ -2 }
   158  d3: (int){ -3 }
   159  d4: (int){ 3 }
   160  de1: (_|_){
   161    // [eval] de1: invalid operands 2.0 and 1 to 'div' (type float and int):
   162    //     ./in.cue:19:6
   163    //     ./in.cue:19:14
   164  }
   165  de2: (_|_){
   166    // [eval] de2: invalid operands 2 and 1.0 to 'div' (type int and float):
   167    //     ./in.cue:20:6
   168    //     ./in.cue:20:12
   169  }
   170  m1: (int){ 1 }
   171  m2: (int){ 1 }
   172  m3: (int){ 1 }
   173  m4: (int){ 1 }
   174  me1: (_|_){
   175    // [eval] me1: invalid operands 2.0 and 1 to 'mod' (type float and int):
   176    //     ./in.cue:26:6
   177    //     ./in.cue:26:14
   178  }
   179  me2: (_|_){
   180    // [eval] me2: invalid operands 2 and 1.0 to 'mod' (type int and float):
   181    //     ./in.cue:27:6
   182    //     ./in.cue:27:12
   183  }
   184}

View as plain text