github.com/solo-io/cue@v0.4.7/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 -- 89 Errors: 90 qe1: invalid operands 2.0 and 1 to 'quo' (type float and int): 91 ./in.cue:5:6 92 ./in.cue:5:14 93 qe2: invalid operands 2 and 1.0 to 'quo' (type int and float): 94 ./in.cue:6:6 95 ./in.cue:6:12 96 re1: invalid operands 2.0 and 1 to 'rem' (type float and int): 97 ./in.cue:12:6 98 ./in.cue:12:14 99 re2: invalid operands 2 and 1.0 to 'rem' (type int and float): 100 ./in.cue:13:6 101 ./in.cue:13:12 102 de1: invalid operands 2.0 and 1 to 'div' (type float and int): 103 ./in.cue:19:6 104 ./in.cue:19:14 105 de2: invalid operands 2 and 1.0 to 'div' (type int and float): 106 ./in.cue:20:6 107 ./in.cue:20:12 108 me1: invalid operands 2.0 and 1 to 'mod' (type float and int): 109 ./in.cue:26:6 110 ./in.cue:26:14 111 me2: invalid operands 2 and 1.0 to 'mod' (type int and float): 112 ./in.cue:27:6 113 ./in.cue:27:12 114 115 Result: 116 (_|_){ 117 // [eval] 118 q1: (int){ 2 } 119 q2: (int){ -2 } 120 q3: (int){ -2 } 121 q4: (int){ 2 } 122 qe1: (_|_){ 123 // [eval] qe1: invalid operands 2.0 and 1 to 'quo' (type float and int): 124 // ./in.cue:5:6 125 // ./in.cue:5:14 126 } 127 qe2: (_|_){ 128 // [eval] qe2: invalid operands 2 and 1.0 to 'quo' (type int and float): 129 // ./in.cue:6:6 130 // ./in.cue:6:12 131 } 132 r1: (int){ 1 } 133 r2: (int){ 1 } 134 r3: (int){ -1 } 135 r4: (int){ -1 } 136 re1: (_|_){ 137 // [eval] re1: invalid operands 2.0 and 1 to 'rem' (type float and int): 138 // ./in.cue:12:6 139 // ./in.cue:12:14 140 } 141 re2: (_|_){ 142 // [eval] re2: invalid operands 2 and 1.0 to 'rem' (type int and float): 143 // ./in.cue:13:6 144 // ./in.cue:13:12 145 } 146 d1: (int){ 2 } 147 d2: (int){ -2 } 148 d3: (int){ -3 } 149 d4: (int){ 3 } 150 de1: (_|_){ 151 // [eval] de1: invalid operands 2.0 and 1 to 'div' (type float and int): 152 // ./in.cue:19:6 153 // ./in.cue:19:14 154 } 155 de2: (_|_){ 156 // [eval] de2: invalid operands 2 and 1.0 to 'div' (type int and float): 157 // ./in.cue:20:6 158 // ./in.cue:20:12 159 } 160 m1: (int){ 1 } 161 m2: (int){ 1 } 162 m3: (int){ 1 } 163 m4: (int){ 1 } 164 me1: (_|_){ 165 // [eval] me1: invalid operands 2.0 and 1 to 'mod' (type float and int): 166 // ./in.cue:26:6 167 // ./in.cue:26:14 168 } 169 me2: (_|_){ 170 // [eval] me2: invalid operands 2 and 1.0 to 'mod' (type int and float): 171 // ./in.cue:27:6 172 // ./in.cue:27:12 173 } 174 }