-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
src/test/java/net/sf/jsqlparser/expression/FunctionWithBooleanParameterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(a<b, c, d)"); | ||
assertEquals("if(a < b, c, d)", result.toString()); | ||
} | ||
|
||
@Test | ||
public void testParseOpLowerOrEqual() throws Exception { | ||
Expression result = CCJSqlParserUtil.parseExpression("if(a+x<=b+y, c, d)"); | ||
assertEquals("if(a + x <= b + y, c, d)", result.toString()); | ||
} | ||
|
||
@Test | ||
public void testParseOpGreaterTotally() throws Exception { | ||
Expression result = CCJSqlParserUtil.parseExpression("if(a>b, 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()); | ||
} | ||
} |