Skip to content

Commit

Permalink
spotless apply
Browse files Browse the repository at this point in the history
  • Loading branch information
not-napoleon committed Dec 7, 2023
1 parent 2c79364 commit 1b9e95c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,18 +263,9 @@ public static List<TestCaseSupplier> forBinaryNumericNotCasting(
);
}

public record StuffForNumericType(
Number min,
Number max,
BinaryOperator<Number> expected,
String evaluatorName
) {}
public record StuffForNumericType(Number min, Number max, BinaryOperator<Number> expected, String evaluatorName) {}

public record AllTheTypeSpecificSettings(
StuffForNumericType intStuff,
StuffForNumericType longStuff,
StuffForNumericType doubleStuff
) {
public record AllTheTypeSpecificSettings(StuffForNumericType intStuff, StuffForNumericType longStuff, StuffForNumericType doubleStuff) {
public StuffForNumericType get(DataType type) {
if (type == DataTypes.INTEGER) {
return intStuff;
Expand Down Expand Up @@ -334,7 +325,7 @@ public static List<TestCaseSupplier> forBinaryWithWidening(
for (DataType rhsType : numericTypes) {
DataType expected = widen(lhsType, rhsType);
StuffForNumericType expectedTypeStuff = typeStuff.get(expected);
String evaluator = expectedTypeStuff.evaluatorName()
String evaluator = expectedTypeStuff.evaluatorName()
+ "["
+ lhsName
+ "="
Expand All @@ -344,16 +335,16 @@ public static List<TestCaseSupplier> forBinaryWithWidening(
+ "="
+ getCastEvaluator("Attribute[channel=1]", rhsType, expected)
+ "]";
casesCrossProduct(
(l, r) -> expectedTypeStuff.expected().apply((Number) l, (Number) r),
getSuppliersForNumericType(lhsType, expectedTypeStuff.min(), expectedTypeStuff.max()),
getSuppliersForNumericType(rhsType, expectedTypeStuff.min(), expectedTypeStuff.max()),
// TODO: This doesn't really need to be a function
(lt, rt) -> evaluator,
warnings,
suppliers,
expected
);
casesCrossProduct(
(l, r) -> expectedTypeStuff.expected().apply((Number) l, (Number) r),
getSuppliersForNumericType(lhsType, expectedTypeStuff.min(), expectedTypeStuff.max()),
getSuppliersForNumericType(rhsType, expectedTypeStuff.min(), expectedTypeStuff.max()),
// TODO: This doesn't really need to be a function
(lt, rt) -> evaluator,
warnings,
suppliers,
expected
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static Iterable<Object[]> parameters() {

// Unsigned Long cases
// TODO: These should be integrated into the type cross product above, but are currently broken
// see https://github.com/elastic/elasticsearch/issues/102935
// see https://github.com/elastic/elasticsearch/issues/102935
suppliers.addAll(
TestCaseSupplier.forBinaryNotCasting(
"AddUnsignedLongsEvaluator",
Expand Down

0 comments on commit 1b9e95c

Please sign in to comment.