diff --git a/src/test/java/net/sf/jsqlparser/expression/FunctionWithBooleanParameterTest.java b/src/test/java/net/sf/jsqlparser/expression/FunctionWithBooleanParameterTest.java new file mode 100644 index 000000000..9e377a32b --- /dev/null +++ b/src/test/java/net/sf/jsqlparser/expression/FunctionWithBooleanParameterTest.java @@ -0,0 +1,68 @@ +/*- + * #%L + * JSQLParser library + * %% + * Copyright (C) 2004 - 2019 JSQLParser + * %% + * Dual licensed under GNU LGPL 2.1 or Apache License 2.0 + * #L% + */ +package net.sf.jsqlparser.expression; + +import net.sf.jsqlparser.parser.CCJSqlParserUtil; +import static org.junit.Assert.assertEquals; +import org.junit.Test; + +/** + * Test some cases linked to a boolean (condition) argument as function parameter. + * + * @author Denis Fulachier + * + */ +public class FunctionWithBooleanParameterTest { + + public FunctionWithBooleanParameterTest() { + } + + @Test + public void testParseOpLowerTotally() throws Exception { + Expression result = CCJSqlParserUtil.parseExpression("if(ab, c, d)"); + assertEquals("if(a > b, c, d)", result.toString()); + } + + @Test + public void testParseOpGreaterOrEqual() throws Exception { + Expression result = CCJSqlParserUtil.parseExpression("if(a>=b, c, d)"); + assertEquals("if(a >= b, c, d)", result.toString()); + } + + @Test + public void testParseOpEqual() throws Exception { + Expression result = CCJSqlParserUtil.parseExpression("if(a=b, c, d)"); + assertEquals("if(a = b, c, d)", result.toString()); + } + + @Test + public void testParseOpNotEqualStandard() throws Exception { + Expression result = CCJSqlParserUtil.parseExpression("if(a<>b, c, d)"); + assertEquals("if(a <> b, c, d)", result.toString()); + } + + @Test + public void testParseOpNotEqualBang() throws Exception { + Expression result = CCJSqlParserUtil.parseExpression("if(a!=b, c, d)"); + assertEquals("if(a != b, c, d)", result.toString()); + } +}