Skip to content

Commit

Permalink
Adding parameter options parser tests
Browse files Browse the repository at this point in the history
Signed-off-by: forestmvey <[email protected]>
  • Loading branch information
forestmvey committed May 26, 2022
1 parent 56ead1b commit 05756cd
Showing 1 changed file with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package org.opensearch.sql.sql.antlr;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

import java.util.stream.Stream;

public class MatchBoolPrefixParserTest extends SQLParserTest {

Expand All @@ -10,6 +13,23 @@ public void testDefaultParameters() {
acceptQuery("SELECT * FROM T WHERE MATCH_BOOL_PREFIX(message, 'query')");
}

static Stream<String> generateAvailableParameters() {
return Stream.of(
new String("minimum_should_match=3"),
new String("fuzziness=AUTO"),
new String("prefix_length=0"),
new String("max_expansions=50"),
new String("fuzzy_transpositions=true"),
new String("fuzzy_rewrite=constant_score")
);
}

@ParameterizedTest
@MethodSource("generateAvailableParameters")
public void testAvailableParameters(String arg) {
acceptQuery("SELECT * FROM T WHERE MATCH_BOOL_PREFIX(message, 'query', " + arg + ")");
}

@Test
public void testOneParameter() {
rejectQuery("SELECT * FROM T WHERE MATCH_BOOL_PREFIX(message)");
Expand Down

0 comments on commit 05756cd

Please sign in to comment.