|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object junit.framework.Assert junit.framework.TestCase org.eigenbase.sql.test.SqlOperatorTests
public abstract class SqlOperatorTests
Contains unit tests for all operators. Each of the methods is named after an operator.
The class is abstract. It contains a test for every operator, but does not
provide a mechanism to execute the tests: parse, validate, and execute
expressions on the operators. This is left to a SqlTester
object
which the derived class must provide.
Different implementations of SqlTester
are possible, such as:
A typical method will be named after the operator it is testing (say
testSubstringFunc
). It first calls SqlTester.setFor(org.eigenbase.sql.SqlOperator,
org.eigenbase.sql.test.SqlTester.VmName...)
to declare which operator it is
testing.
public void testSubstringFunc() {
getTester().setFor(SqlStdOperatorTable.substringFunc);
getTester().checkScalar("sin(0)", "0");
getTester().checkScalar("sin(1.5707)", "1");
}
checkXxx
methods in the SqlTester
interface. For an operator
to be adequately tested, there need to be tests for:
Field Summary | |
---|---|
static String |
badDatetimeMessage
|
static Pattern |
datePattern
Regular expression for a SQL DATE value. |
protected static TimeZone |
defaultTimeZone
|
static String |
divisionByZeroMessage
|
private static boolean[] |
FalseTrue
|
protected static TimeZone |
gmtTimeZone
|
static String |
invalidCharMessage
|
static String |
literalOutOfRangeMessage
|
static String[] |
maxNumericStrings
|
static String[] |
maxOverflowNumericStrings
|
static String[] |
minNumericStrings
|
static String[] |
minOverflowNumericStrings
|
static String |
NL
|
static String[] |
numericTypeNames
|
static String |
outOfRangeMessage
|
static String |
stringTruncMessage
|
static Pattern |
timePattern
Regular expression for a SQL TIME(0) value. |
static Pattern |
timestampPattern
Regular expression for a SQL TIMESTAMP(0) value. |
static boolean |
todo
|
private static SqlTester.VmName |
VM_EXPAND
|
private static SqlTester.VmName |
VM_FENNEL
|
private static SqlTester.VmName |
VM_JAVA
|
Constructor Summary | |
---|---|
SqlOperatorTests(String testName)
|
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runBare, runTest, setName, tearDown, toString |
Methods inherited from class junit.framework.Assert |
---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String NL
public static final String invalidCharMessage
public static final String outOfRangeMessage
public static final String divisionByZeroMessage
public static final String stringTruncMessage
public static final String badDatetimeMessage
public static final String literalOutOfRangeMessage
public static final boolean todo
public static final Pattern timePattern
public static final Pattern timestampPattern
public static final Pattern datePattern
public static final String[] numericTypeNames
public static final String[] minNumericStrings
public static final String[] minOverflowNumericStrings
public static final String[] maxNumericStrings
public static final String[] maxOverflowNumericStrings
private static final boolean[] FalseTrue
private static final SqlTester.VmName VM_FENNEL
private static final SqlTester.VmName VM_JAVA
private static final SqlTester.VmName VM_EXPAND
protected static final TimeZone gmtTimeZone
protected static final TimeZone defaultTimeZone
Constructor Detail |
---|
public SqlOperatorTests(String testName)
Method Detail |
---|
protected abstract SqlTester getTester()
protected void setUp() throws Exception
setUp
in class TestCase
Exception
public void testBetween()
public void testNotBetween()
private String getCastString(String value, String targetType, boolean errorLoc)
private void checkCastToApproxOkay(String value, String targetType, double expected, double delta)
private void checkCastToStringOkay(String value, String targetType, String expected)
private void checkCastToScalarOkay(String value, String targetType, String expected)
private void checkCastToScalarOkay(String value, String targetType)
private void checkCastFails(String value, String targetType, String expectedError, boolean runtime)
private void checkCastToString(String value, String type, String expected)
public void testCastToString()
public void testCastExactNumericLimits()
public void testCastToExactNumeric()
public void testCastWithRoundingToScalar()
public void testCastDecimalToDoubleToInteger()
public void testCastApproxNumericLimits()
public void testCastToApproxNumeric()
public void testCastNull()
public void testCastDateTime()
protected static Calendar getCalendarNotTooNear(int timeUnit)
timeUnit
- Time unit
public void testCastToBoolean()
public void testCase()
public void testCaseType()
public void testJdbcFn()
See FRG-97 "Support for JDBC escape syntax is incomplete".
public void testSelect()
public void testLiteralChain()
public void testRow()
public void testAndOperator()
public void testConcatOperator()
public void testDivideOperator()
public void testEqualsOperator()
public void testGreaterThanOperator()
public void testIsDistinctFromOperator()
public void testIsNotDistinctFromOperator()
public void testGreaterThanOrEqualOperator()
public void testInOperator()
public void testNotInOperator()
public void testOverlapsOperator()
public void testLessThanOperator()
public void testLessThanOrEqualOperator()
public void testMinusOperator()
public void testMinusIntervalOperator()
public void testMinusDateOperator()
public void testMultiplyOperator()
public void testNotEqualsOperator()
public void testOrOperator()
public void testPlusOperator()
public void testPlusIntervalOperator()
public void testDescendingOperator()
public void testIsNotNullOperator()
public void testIsNullOperator()
public void testIsNotTrueOperator()
public void testIsTrueOperator()
public void testIsNotFalseOperator()
public void testIsFalseOperator()
public void testIsNotUnknownOperator()
public void testIsUnknownOperator()
public void testIsASetOperator()
public void testExistsOperator()
public void testNotOperator()
public void testPrefixMinusOperator()
public void testPrefixPlusOperator()
public void testExplicitTableOperator()
public void testValuesOperator()
public void testNotLikeOperator()
public void testLikeOperator()
public void testNotSimilarToOperator()
public void testSimilarToOperator()
public void testEscapeOperator()
public void testConvertFunc()
public void testTranslateFunc()
public void testOverlayFunc()
public void testPositionFunc()
public void testCharLengthFunc()
public void testCharacterLengthFunc()
public void testUpperFunc()
public void testLowerFunc()
public void testInitcapFunc()
public void testPowerFunc()
public void testExpFunc()
public void testModFunc()
public void testModFuncDivByZero()
public void testLnFunc()
public void testLogFunc()
public void testAbsFunc()
public void testNullifFunc()
public void testCoalesceFunc()
public void testUserFunc()
public void testCurrentUserFunc()
public void testSessionUserFunc()
public void testSystemUserFunc()
public void testCurrentPathFunc()
public void testCurrentRoleFunc()
public void testLocalTimeFunc()
public void testLocalTimestampFunc()
public void testCurrentTimeFunc()
public void testCurrentTimestampFunc()
protected static String currentTimeString(TimeZone tz)
For example, at "2005-01-01 12:34:56 PST", returns "2005-01-01 20:". At "2005-01-01 12:34:59 PST", waits a minute, then returns "2005-01-01 21:".
tz
- Time zone
public void testCurrentDateFunc()
public void testSubstringFunction()
public void testTrimFunc()
public void testWindow()
public void testElementFunc()
public void testCardinalityFunc()
public void testMemberOfOperator()
public void testCollectFunc()
public void testFusionFunc()
public void testExtractFunc()
public void testCeilFunc()
public void testFloorFunc()
public void testDenseRankFunc()
public void testPercentRankFunc()
public void testRankFunc()
public void testCumeDistFunc()
public void testRowNumberFunc()
public void testCountFunc()
public void testSumFunc()
public void testAvgFunc()
public void testMinFunc()
public void testMaxFunc()
public void testLastValueFunc()
public void testFirstValueFunc()
public void testLiteralAtLimit()
public void testLiteralBeyondLimit()
public void testCastTruncates()
private List<Object> getValues(BasicSqlType type, boolean inBound)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |