|
12 | 12 | // See the License for the specific language governing permissions and |
13 | 13 | // limitations under the License. |
14 | 14 |
|
15 | | -package dev.cel.parser; |
| 15 | +package dev.cel.common; |
16 | 16 |
|
17 | 17 | import static com.google.common.truth.Truth.assertThat; |
18 | 18 | import static org.junit.Assert.assertEquals; |
19 | | -import static org.junit.Assert.assertFalse; |
20 | | -import static org.junit.Assert.assertTrue; |
21 | 19 |
|
22 | 20 | import com.google.testing.junit.testparameterinjector.TestParameter; |
23 | 21 | import com.google.testing.junit.testparameterinjector.TestParameterInjector; |
24 | 22 | import com.google.testing.junit.testparameterinjector.TestParameters; |
25 | | -import dev.cel.common.ast.CelExpr; |
26 | | -import dev.cel.common.ast.CelExpr.CelCall; |
27 | 23 | import java.util.Optional; |
28 | 24 | import org.junit.Test; |
29 | 25 | import org.junit.runner.RunWith; |
@@ -150,70 +146,4 @@ public void lookupBinaryOperator_nonEmpty(String operator, String value) { |
150 | 146 | public void lookupBinaryOperator_empty(String operator) { |
151 | 147 | assertEquals(Operator.lookupBinaryOperator(operator), Optional.empty()); |
152 | 148 | } |
153 | | - |
154 | | - @Test |
155 | | - @TestParameters({ |
156 | | - "{operator1: '_[_]', operator2: '_&&_'}", |
157 | | - "{operator1: '_&&_', operator2: '_||_'}", |
158 | | - "{operator1: '_||_', operator2: '_?_:_'}", |
159 | | - "{operator1: '!_', operator2: '_*_'}", |
160 | | - "{operator1: '_==_', operator2: '_&&_'}", |
161 | | - "{operator1: '_!=_', operator2: '_?_:_'}", |
162 | | - }) |
163 | | - public void operatorLowerPrecedence(String operator1, String operator2) { |
164 | | - CelExpr expr = |
165 | | - CelExpr.newBuilder().setCall(CelCall.newBuilder().setFunction(operator2).build()).build(); |
166 | | - |
167 | | - assertTrue(Operator.isOperatorLowerPrecedence(operator1, expr)); |
168 | | - } |
169 | | - |
170 | | - @Test |
171 | | - @TestParameters({ |
172 | | - "{operator1: '_?_:_', operator2: '_&&_'}", |
173 | | - "{operator1: '_&&_', operator2: '_[_]'}", |
174 | | - "{operator1: '_||_', operator2: '!_'}", |
175 | | - "{operator1: '!_', operator2: '-_'}", |
176 | | - "{operator1: '_==_', operator2: '_!=_'}", |
177 | | - "{operator1: '_!=_', operator2: '_-_'}", |
178 | | - }) |
179 | | - public void operatorNotLowerPrecedence(String operator1, String operator2) { |
180 | | - CelExpr expr = |
181 | | - CelExpr.newBuilder().setCall(CelCall.newBuilder().setFunction(operator2).build()).build(); |
182 | | - |
183 | | - assertFalse(Operator.isOperatorLowerPrecedence(operator1, expr)); |
184 | | - } |
185 | | - |
186 | | - @Test |
187 | | - @TestParameters({ |
188 | | - "{operator: '_[_]'}", |
189 | | - "{operator: '!_'}", |
190 | | - "{operator: '_==_'}", |
191 | | - "{operator: '_?_:_'}", |
192 | | - "{operator: '_!=_'}", |
193 | | - "{operator: '_<_'}", |
194 | | - "{operator: '_<=_'}", |
195 | | - "{operator: '_>_'}", |
196 | | - "{operator: '_>=_'}", |
197 | | - "{operator: '_+_'}", |
198 | | - "{operator: '_-_'}", |
199 | | - "{operator: '_*_'}", |
200 | | - "{operator: '_/_'}", |
201 | | - "{operator: '_%_'}", |
202 | | - "{operator: '-_'}", |
203 | | - "{operator: 'has'}", |
204 | | - "{operator: '_[?_]'}", |
205 | | - "{operator: '@not_strictly_false'}", |
206 | | - }) |
207 | | - public void operatorLeftRecursive(String operator) { |
208 | | - assertTrue(Operator.isOperatorLeftRecursive(operator)); |
209 | | - } |
210 | | - |
211 | | - @Test |
212 | | - @TestParameters({ |
213 | | - "{operator: '_&&_'}", |
214 | | - "{operator: '_||_'}", |
215 | | - }) |
216 | | - public void operatorNotLeftRecursive(String operator) { |
217 | | - assertFalse(Operator.isOperatorLeftRecursive(operator)); |
218 | | - } |
219 | 149 | } |
0 commit comments