andreachild commented on code in PR #3121: URL: https://github.com/apache/tinkerpop/pull/3121#discussion_r2105461894
########## gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/util/NumberHelperTest.java: ########## @@ -99,20 +114,36 @@ public class NumberHelperTest { ); private final static List<Triplet<Number, Number, String>> OVERFLOW_CASES = Arrays.asList( - new Triplet<>(Integer.MAX_VALUE, 1, "add"), - new Triplet<>(Integer.MIN_VALUE, 1, "sub"), - new Triplet<>(Integer.MAX_VALUE, Integer.MAX_VALUE, "mul"), new Triplet<>(Long.MAX_VALUE, 1L, "add"), new Triplet<>(Long.MIN_VALUE, 1L, "sub"), - new Triplet<>(Long.MAX_VALUE, Integer.MAX_VALUE, "mul"), - new Triplet<>(Byte.MAX_VALUE, (byte)100, "add"), - new Triplet<>(Byte.MIN_VALUE, (byte)100, "sub"), - new Triplet<>((byte)100, (byte)100, "mul"), - new Triplet<>(Short.MAX_VALUE, (short)100, "add"), - new Triplet<>(Short.MIN_VALUE, (short)100, "sub"), - new Triplet<>(Short.MAX_VALUE, (short)100, "mul") + new Triplet<>(Long.MAX_VALUE, Integer.MAX_VALUE, "mul") + ); + + private final static List<Quartet<Number, Number, String, String>> NO_OVERFLOW_CASES = Arrays.asList( + new Quartet<>(Byte.MAX_VALUE, (byte)100, "add", "s"), + new Quartet<>(Byte.MIN_VALUE, (byte)100, "sub", "s"), + new Quartet<>((byte)100, (byte)100, "mul", "s"), + new Quartet<>(Byte.MAX_VALUE, 0.5f, "div", "f"), + new Quartet<>(Short.MAX_VALUE, (short)100, "add", "i"), + new Quartet<>(Short.MIN_VALUE, (short)100, "sub", "i"), + new Quartet<>(Short.MAX_VALUE, (short)100, "mul", "i"), + new Quartet<>(Short.MAX_VALUE, 0.5f, "div", "f"), + new Quartet<>(Integer.MAX_VALUE, 1, "add", "l"), + new Quartet<>(Integer.MIN_VALUE, 1, "sub", "l"), + new Quartet<>(Integer.MAX_VALUE, Integer.MAX_VALUE, "mul", "l"), + new Quartet<>(Integer.MAX_VALUE, 0.5f, "div", "f"), + new Quartet<>(Long.MAX_VALUE, 0.5f, "div", "d") ); + @Test + public void shouldReturnHighestCommonNumberNumberInfo() { + for (final Triplet<Number, Integer, Boolean> q : NUMBER_INFO_CASES) { Review Comment: Nit: it would be better to use junit's `Parameterized` instead of a for loop inside a single test because it would run each execution separately, making it easier to pinpoint which test cases passed and which failed. Using a for loop will just fail the entire test and then you'll need to debug which scenario failed. See `GeneralLiteralVisitorTest` as an example of how `Parameterized` can be used. -- 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: commits-unsubscr...@tinkerpop.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org