Skip to content

Commit

Permalink
A math
Browse files Browse the repository at this point in the history
  • Loading branch information
nik9000 committed Jan 7, 2025
1 parent 480d273 commit dd69fab
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

package org.elasticsearch.xpack.esql.expression.predicate.operator.arithmetic;

import org.elasticsearch.xpack.esql.core.expression.Expression;
import org.elasticsearch.xpack.esql.core.tree.Source;
import org.elasticsearch.xpack.esql.core.type.DataType;
import org.elasticsearch.xpack.esql.expression.function.ErrorsForCasesWithoutExamplesTestCase;
import org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier;
import org.elasticsearch.xpack.esql.expression.function.scalar.string.StartsWith;
import org.elasticsearch.xpack.esql.expression.function.scalar.string.StartsWithTests;
import org.hamcrest.Matcher;

import java.util.List;
import java.util.Set;

import static org.hamcrest.Matchers.equalTo;

public class NegErrorTests extends ErrorsForCasesWithoutExamplesTestCase {
@Override
protected List<TestCaseSupplier> cases() {
return paramsToSuppliers(NegTests.parameters());
}

@Override
protected Expression build(Source source, List<Expression> args) {
return new Neg(source, args.get(0));
}

@Override
protected Matcher<String> expectedTypeErrorMatcher(List<Set<DataType>> validPerPosition, List<DataType> signature) {
return equalTo(typeErrorMessage(false, validPerPosition, signature, (v, p) -> "numeric, date_period or time_duration"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static Iterable<Object[]> parameters() {
equalTo(arg.negated())
).withoutEvaluator();
})));
return parameterSuppliersFromTypedDataWithDefaultChecks(false, suppliers, (v, p) -> "numeric, date_period or time_duration");
return parameterSuppliersFromTypedDataWithDefaultChecksNoErrors(false, suppliers);
}

@Override
Expand Down

0 comments on commit dd69fab

Please sign in to comment.