Skip to content

Commit

Permalink
When cartesian decoding fails, we should test and mimic that failure
Browse files Browse the repository at this point in the history
  • Loading branch information
craigtaverner committed Dec 20, 2023
1 parent b10d812 commit 73dfed8
Showing 1 changed file with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,23 @@ public static Iterable<Object[]> parameters() {
final List<TestCaseSupplier> suppliers = new ArrayList<>();

TestCaseSupplier.forUnaryCartesianPoint(suppliers, attribute, EsqlDataTypes.CARTESIAN_POINT, l -> l, List.of());
TestCaseSupplier.forUnaryLong(
suppliers,
evaluatorName.apply("FromLong"),
EsqlDataTypes.CARTESIAN_POINT,
CARTESIAN::longAsPoint,
Long.MIN_VALUE,
Long.MAX_VALUE,
List.of()
);
TestCaseSupplier.forUnaryLong(suppliers, evaluatorName.apply("FromLong"), EsqlDataTypes.CARTESIAN_POINT, l -> {
try {
return CARTESIAN.longAsPoint(l);
} catch (IllegalArgumentException e) {
return null;
}
}, Long.MIN_VALUE, Long.MAX_VALUE, l -> {
try {
CARTESIAN.longAsPoint(l.longValue());
return List.of();
} catch (IllegalArgumentException e) {
return List.of(
"Line -1:-1: evaluation of [] failed, treating result as null. Only first 20 failures recorded.",
"Line -1:-1: " + e.getMessage()
);
}
});
// random strings that don't look like a cartesian point
TestCaseSupplier.forUnaryStrings(
suppliers,
Expand Down

0 comments on commit 73dfed8

Please sign in to comment.