cuelang.org/go@v0.10.1/cue/testdata/basicrewrite/003_integer-specific_arithmetic.txtar (about) 1 # DO NOT EDIT; generated by go run testdata/gen.go 2 # 3 #name: integer-specific arithmetic 4 #evalPartial 5 -- in.cue -- 6 q1: 5 quo 2 // 2 7 q2: 5 quo -2 // -2 8 q3: -5 quo 2 // -2 9 q4: -5 quo -2 // 2 10 qe1: 2.0 quo 1 11 qe2: 2 quo 1.0 12 13 r1: 5 rem 2 // 1 14 r2: 5 rem -2 // 1 15 r3: -5 rem 2 // -1 16 r4: -5 rem -2 // -1 17 re1: 2.0 rem 1 18 re2: 2 rem 1.0 19 20 d1: 5 div 2 // 2 21 d2: 5 div -2 // -2 22 d3: -5 div 2 // -3 23 d4: -5 div -2 // 3 24 de1: 2.0 div 1 25 de2: 2 div 1.0 26 27 m1: 5 mod 2 // 1 28 m2: 5 mod -2 // 1 29 m3: -5 mod 2 // 1 30 m4: -5 mod -2 // 1 31 me1: 2.0 mod 1 32 me2: 2 mod 1.0 33 -- out/def -- 34 q1: 2 35 q2: -2 36 q3: -2 37 q4: 2 38 qe1: _|_ // invalid operation 2.0 quo 1 (mismatched types float and int) 39 qe2: _|_ // invalid operation 2 quo 1.0 (mismatched types int and float) 40 r1: 1 41 r2: 1 42 r3: -1 43 r4: -1 44 re1: _|_ // invalid operation 2.0 rem 1 (mismatched types float and int) 45 re2: _|_ // invalid operation 2 rem 1.0 (mismatched types int and float) 46 d1: 2 47 d2: -2 48 d3: -3 49 d4: 3 50 de1: _|_ // invalid operation 2.0 div 1 (mismatched types float and int) 51 de2: _|_ // invalid operation 2 div 1.0 (mismatched types int and float) 52 m1: 1 53 m2: 1 54 m3: 1 55 m4: 1 56 me1: _|_ // invalid operation 2.0 mod 1 (mismatched types float and int) 57 me2: _|_ // 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 -- 89 Leaks: 0 90 Freed: 25 91 Reused: 23 92 Allocs: 2 93 Retain: 0 94 95 Unifications: 25 96 Conjuncts: 25 97 Disjuncts: 25 98 -- out/eval -- 99 Errors: 100 qe1: invalid operands 2.0 and 1 to 'quo' (type float and int): 101 ./in.cue:5:6 102 ./in.cue:5:14 103 qe2: invalid operands 2 and 1.0 to 'quo' (type int and float): 104 ./in.cue:6:6 105 ./in.cue:6:12 106 re1: invalid operands 2.0 and 1 to 'rem' (type float and int): 107 ./in.cue:12:6 108 ./in.cue:12:14 109 re2: invalid operands 2 and 1.0 to 'rem' (type int and float): 110 ./in.cue:13:6 111 ./in.cue:13:12 112 de1: invalid operands 2.0 and 1 to 'div' (type float and int): 113 ./in.cue:19:6 114 ./in.cue:19:14 115 de2: invalid operands 2 and 1.0 to 'div' (type int and float): 116 ./in.cue:20:6 117 ./in.cue:20:12 118 me1: invalid operands 2.0 and 1 to 'mod' (type float and int): 119 ./in.cue:26:6 120 ./in.cue:26:14 121 me2: invalid operands 2 and 1.0 to 'mod' (type int and float): 122 ./in.cue:27:6 123 ./in.cue:27:12 124 125 Result: 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 }