From a3f45b7d59c998c29735619f3d8c26f7592f82b4 Mon Sep 17 00:00:00 2001 From: Mark Tozzi Date: Mon, 11 Dec 2023 17:42:50 -0500 Subject: [PATCH] are these names better? I can't even tell, it's late and I'm tired --- .../esql/expression/function/TestCaseSupplier.java | 14 +++++++++----- .../predicate/operator/arithmetic/AddTests.java | 8 ++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/TestCaseSupplier.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/TestCaseSupplier.java index 506f8d59276d1..08e952062255a 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/TestCaseSupplier.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/TestCaseSupplier.java @@ -267,10 +267,14 @@ public static List forBinaryNumericNotCasting( ); } - public record StuffForNumericType(Number min, Number max, BinaryOperator expected, String evaluatorName) {} + public record NumericTypeTestConfig(Number min, Number max, BinaryOperator expected, String evaluatorName) {} - public record AllTheTypeSpecificSettings(StuffForNumericType intStuff, StuffForNumericType longStuff, StuffForNumericType doubleStuff) { - public StuffForNumericType get(DataType type) { + public record NumericTypeTestConfigs( + NumericTypeTestConfig intStuff, + NumericTypeTestConfig longStuff, + NumericTypeTestConfig doubleStuff + ) { + public NumericTypeTestConfig get(DataType type) { if (type == DataTypes.INTEGER) { return intStuff; } @@ -317,7 +321,7 @@ private static List getSuppliersForNumericType(DataType type, } public static List forBinaryWithWidening( - AllTheTypeSpecificSettings typeStuff, + NumericTypeTestConfigs typeStuff, String lhsName, String rhsName, List warnings @@ -328,7 +332,7 @@ public static List forBinaryWithWidening( for (DataType lhsType : numericTypes) { for (DataType rhsType : numericTypes) { DataType expected = widen(lhsType, rhsType); - StuffForNumericType expectedTypeStuff = typeStuff.get(expected); + NumericTypeTestConfig expectedTypeStuff = typeStuff.get(expected); String evaluator = expectedTypeStuff.evaluatorName() + "[" + lhsName diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/arithmetic/AddTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/arithmetic/AddTests.java index edf199942f688..91f5a80076626 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/arithmetic/AddTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/arithmetic/AddTests.java @@ -45,20 +45,20 @@ public static Iterable parameters() { List suppliers = new ArrayList<>(); suppliers.addAll( TestCaseSupplier.forBinaryWithWidening( - new TestCaseSupplier.AllTheTypeSpecificSettings( - new TestCaseSupplier.StuffForNumericType( + new TestCaseSupplier.NumericTypeTestConfigs( + new TestCaseSupplier.NumericTypeTestConfig( (Integer.MIN_VALUE >> 1) - 1, (Integer.MAX_VALUE >> 1) - 1, (l, r) -> l.intValue() + r.intValue(), "AddIntsEvaluator" ), - new TestCaseSupplier.StuffForNumericType( + new TestCaseSupplier.NumericTypeTestConfig( (Long.MIN_VALUE >> 1) - 1, (Long.MAX_VALUE >> 1) - 1, (l, r) -> l.longValue() + r.longValue(), "AddLongsEvaluator" ), - new TestCaseSupplier.StuffForNumericType( + new TestCaseSupplier.NumericTypeTestConfig( Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, (l, r) -> l.doubleValue() + r.doubleValue(),