Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
wumpz committed Feb 10, 2019
1 parent f79f58d commit 73305fe
Showing 1 changed file with 68 additions and 0 deletions.
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());
}
}

0 comments on commit 73305fe

Please sign in to comment.