ekaterinadimitrova2 commented on code in PR #3301:
URL: https://github.com/apache/cassandra/pull/3301#discussion_r1608525619
##########
src/java/org/apache/cassandra/cql3/Operator.java:
##########
@@ -266,6 +266,59 @@ public boolean canBeUsedWith(ColumnsExpression.Kind kind)
return kind != ColumnsExpression.Kind.MAP_ELEMENT;
}
},
+ BETWEEN(16)
Review Comment:
I was wondering, maybe we want to add a defensive unit test that will check
the numbers used and break if someone does something wrong?
```
@Test
public void testOperatorOrder() {
int[] expectedValues = {0, 4, 3, 1, 2, 7, 5, 6, 8, 9, 10, 11, 12,
13, 14, 15};
Operator[] operators = Operator.values();
assertEquals("Number of operators has changed",
expectedValues.length, operators.length);
for (int i = 0; i < operators.length; i++) {
assertEquals("Operator " + operators[i].name() + " has incorrect
value", expectedValues[i], operators[i].getValue());
}
}
```
This test will fail if the number of operators or the b value of any
operator is changed. It will also fail if a new operator is added but does not
take the next number in line.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]