public class MathTrigFunctionsTest extends BaseJDBCTestCase
Modifier and Type | Field and Description |
---|---|
(package private) static double |
DOUBLE_MIN_NORMAL |
private static double[] |
logValues |
private static double |
PRE_DERBY_3398_LARGEST_NEG_DERBY_DOUBLE |
private static double |
PRE_DERBY_3398_LARGEST_POS_DERBY_DOUBLE |
private static double |
PRE_DERBY_3398_SMALLEST_NEG_DERBY_DOUBLE |
private static double |
PRE_DERBY_3398_SMALLEST_POS_DERBY_DOUBLE |
private static double |
SMALL_NEG_DOUBLE |
private static double[] |
testArcValues |
private static double[] |
testRadians |
private static double[] |
testValues |
private static double[] |
testValuesTwo |
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
MathTrigFunctionsTest(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
private void |
checkResult(java.sql.PreparedStatement ps,
double input,
double expected) |
private void |
debug() |
private void |
debug(java.lang.String message) |
private double |
executeFn(java.lang.String functionName) |
private double |
executeFn(java.lang.String functionName,
double value) |
private void |
executeNullFn(java.lang.String functionName) |
private void |
executeNullValues(java.lang.String functionName) |
private double |
executeValues(java.lang.String functionName) |
private double |
executeValues(java.lang.String functionName,
double value) |
private double |
getValue(java.sql.PreparedStatement ps,
double value)
Execute a prepared statement with a single double argument
and return the double value from the single row returned.
|
static junit.framework.Test |
suite()
Runs the tests in the embedded and client server configuration
as the JDBC escape function testing is relevant for both drivers.
|
void |
testAcos()
Tests the ACOS function which returns the arc cosine of a specified
number.
|
void |
testAsin()
Tests the ASIN function which returns the arc sine of a specified number.
|
void |
testAtan()
Tests the ATAN function which returns the arc tangent of a specified
number.
|
void |
testCeil()
Tests the CEIL function which rounds a DOUBLE PRECISION number up, and
return the smallest number that is greater than or equal to the input
number.
|
void |
testCeiling()
Tests the CEILING function which rounds a DOUBLE PRECISION number up, and
return the smallest number that is greater than or equal to the input
number.
|
void |
testCos()
Tests the COS function which returns the cosine of a specified number.
|
void |
testCosh() |
void |
testCot() |
void |
testDegrees()
Tests the DEGREES function which converts a DOUBLE PRECISION number from
radians to degrees.
|
void |
testExp()
Tests the EXP function which returns e raised to the power of the input
DOUBLE PRECISION number.
|
void |
testFloor()
Tests the FLOOR function which rounds the input value which must be a
DOUBLE PRECISION number down, and returns the largest number that is less
than or equal to the input value.
|
void |
testLn()
Tests the LN function which returns the natural logarithm (base e) of a
DOUBLE PRECISION number that is greater than zero (0).
|
void |
testLog()
Tests the LOG function which returns the natural logarithm (base e) of a
DOUBLE PRECISION number that is greater than zero (0).
|
void |
testLog10()
Tests the LOG10 function which returns the base-10 logarithm of a DOUBLE
PRECISION number that is greater than zero.
|
void |
testPI()
Tests the PI function which returns a value that is closer than any other
value to pi.
|
void |
testRadians()
Tests the RADIANS function which converts a DOUBLE PRECISION number from
degrees to radians.
|
void |
testSin()
Tests the SIN function which returns the sine of a specified number.
|
void |
testSinh() |
void |
testTan()
Tests the TAN function which returns the tangent of a specified number.
|
void |
testTanh() |
assertCallError, assertCheckTable, assertCommitError, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertErrorCode, assertGetIntError, assertNextError, assertPreparedStatementError, assertResults, assertResults, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertStatementErrorUnordered, assertTableRowCount, assertUpdateCount, assertUpdateCount, assertWarning, chattyPrepare, chattyPrepareCall, checkAllConsistency, checkEstimatedRowCount, closeStatement, commit, createStatement, createStatement, createStatement, dropTable, dropTable, dropView, dropView, dumpRs, dumpRs, emptyStatementCache, executeQuery, expectCompilationError, expectCompilationError, expectExecutionError, getClientTransactionID, getConnection, getDatabaseProperty, getLastSQLException, goodStatement, goodUpdate, initializeConnection, openConnection, openDefaultConnection, openDefaultConnection, openDefaultConnection, openUserConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, rollback, runBare, runBareOverridable, runScript, runScript, runSQLCommands, setAutoCommit, tearDown, usingDB2Client, usingDerbyNetClient, usingEmbedded
alarm, assertDirectoryDeleted, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertLaunchedJUnitTestMethod, assertLaunchedJUnitTestMethod, assertSameNullness, assertSecurityManager, assertThrowableEquals, currentDirectory, execJavaCmd, execJavaCmd, execJavaCmd, fail, getClassVersionMajor, getEmmaJar, getFailureFolder, getFilesWith, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, hasInterruptibleIO, isCVM, isIBMJVM, isJ9Platform, isJava5, isJava7, isPhoneME, isPlatform, isSunJVM, isWindowsPlatform, newAssertionFailedError, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeFiles, removeSystemProperty, runsWithEmma, runsWithJaCoCo, setSystemErr, setSystemOut, setSystemProperty, sleep, sleepAtLeastOneTick, traceit, vmAtLeast
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runTest, setName, setUp, toString
private static final double PRE_DERBY_3398_SMALLEST_NEG_DERBY_DOUBLE
private static final double SMALL_NEG_DOUBLE
private static final double PRE_DERBY_3398_SMALLEST_POS_DERBY_DOUBLE
private static final double PRE_DERBY_3398_LARGEST_POS_DERBY_DOUBLE
private static final double PRE_DERBY_3398_LARGEST_NEG_DERBY_DOUBLE
private static final double[] testRadians
private static final double[] testArcValues
private static final double[] logValues
private static final double[] testValues
private static final double[] testValuesTwo
static final double DOUBLE_MIN_NORMAL
public void testAcos() throws java.sql.SQLException
Acceptable input values to the ACOS function are DOUBLE PRECISION values from -1 to 1. NULL returns NULL and if the absolute value of the input is greater than 1 an SQL state of 22003 is returned.
The return value from the ACOS function is a DOUBLE PRECISION number in radians with a range of zero to PI.
java.sql.SQLException
public void testAsin() throws java.sql.SQLException
Acceptable input values to the ASIN function are DOUBLE PRECISION values from -1 to 1.
If the specified number is zero (0), the result of this function is zero. Note: Derby does not support negative zero.
An input value of NULL returns NULL.
If the absolute value of the input is greater than 1 an SQL state of 22003 is returned.
The return value from the ASIN function is a DOUBLE PRECISION number in radians with a range of -PI/2 to PI/2.
java.sql.SQLException
public void testAtan() throws java.sql.SQLException
If the specified number is zero (0), the result of this function is zero. An input value of NULL returns NULL.
The return value from the ATAN function is a DOUBLE PRECISION number in radians with a range of -PI/2 to PI/2.
java.sql.SQLException
public void testCos() throws java.sql.SQLException
Acceptable input values to the COS function are DOUBLE PRECISION values.
An input value of NULL returns NULL.
java.sql.SQLException
public void testSin() throws java.sql.SQLException
Acceptable input values to the SIN function are DOUBLE PRECISION values.
An input value of NULL returns NULL.
If the argument is zero, then the result is zero.
The data type of the returned value is a DOUBLE PRECISION number.
java.sql.SQLException
public void testTan() throws java.sql.SQLException
Acceptable input values to the TAN function are DOUBLE PRECISION values.
An input value of NULL returns NULL.
If the argument is zero, then the result is zero.
The data type of the returned value is a DOUBLE PRECISION number.
java.sql.SQLException
public void testCot() throws java.sql.SQLException
java.sql.SQLException
private void checkResult(java.sql.PreparedStatement ps, double input, double expected) throws java.sql.SQLException
java.sql.SQLException
public void testCosh() throws java.sql.SQLException
java.sql.SQLException
public void testSinh() throws java.sql.SQLException
java.sql.SQLException
public void testTanh() throws java.sql.SQLException
java.sql.SQLException
public void testPI() throws java.sql.SQLException
The constant pi is the ratio of the circumference of a circle to the diameter of a circle.
No input values are allowed for the PI function.
java.sql.SQLException
public void testDegrees() throws java.sql.SQLException
The input is an angle measured in radians, which is converted to an approximately equivalent angle measured in degrees.
The conversion from radians to degrees is not exact. You should not expect that the COS(DEGREES(PI/2)) to exactly equal 0.0.
The return value is a DOUBLE PRECISION number.
java.sql.SQLException
public void testRadians() throws java.sql.SQLException
The input is an angle measured in degrees, which is converted to an approximately equivalent angle measured in radians.
The conversion from radians to degrees is not exact. You should not expect that the COS(RADIANS(90.0)) to exactly equal 0.0.
The return value is a DOUBLE PRECISION number.
java.sql.SQLException
public void testExp() throws java.sql.SQLException
The constant e is the base of the natural logarithms.
The return value is a DOUBLE PRECISION number.
java.sql.SQLException
public void testLog10() throws java.sql.SQLException
If the input value is NULL, the result of this function is NULL.
If the input value is zero or a negative number, an exception is returned that indicates that the value is out of range (SQL state 22003).
The return type is a DOUBLE PRECISION number.
java.sql.SQLException
public void testLog() throws java.sql.SQLException
If the specified number is NULL, the result of these functions is NULL. If the specified number is zero or a negative number, an exception is returned that indicates that the value is out of range (SQL state 22003).
The data type of the returned value is a DOUBLE PRECISION number.
java.sql.SQLException
public void testLn() throws java.sql.SQLException
If the specified number is NULL, the result of these functions is NULL. If the specified number is zero or a negative number, an exception is returned that indicates that the value is out of range (SQL state 22003).
The data type of the returned value is a DOUBLE PRECISION number.
java.sql.SQLException
public void testCeil() throws java.sql.SQLException
If the input number is NULL, the result of these functions is NULL. If the input number is equal to a mathematical integer, the result of these functions is the same as the input number. If the input number is zero (0), the result of these functions is zero. If the input number is less than zero but greater than -1.0, then the result of these functions is zero.
The returned value is the smallest (closest to negative infinity) double floating point value that is greater than or equal to the specified number. The returned value is equal to a mathematical integer.
The data type of the returned value is a DOUBLE PRECISION number.
java.sql.SQLException
public void testCeiling() throws java.sql.SQLException
If the input number is NULL, the result of these functions is NULL. If the input number is equal to a mathematical integer, the result of these functions is the same as the input number. If the input number is zero (0), the result of these functions is zero. If the input number is less than zero but greater than -1.0, then the result of these functions is zero.
The returned value is the smallest (closest to negative infinity) double floating point value that is greater than or equal to the specified number. The returned value is equal to a mathematical integer.
The data type of the returned value is a DOUBLE PRECISION number.
java.sql.SQLException
public void testFloor() throws java.sql.SQLException
If the input value is NULL, the result of this function is NULL. If the input value is equal to a mathematical integer, the result of this function is the same as the input number. If the input value is zero (0), the result of this function is zero.
The returned value is the largest (closest to positive infinity) double floating point value that is less than or equal to the input value. The returned value is equal to a mathematical integer. The data type of the returned value is a DOUBLE PRECISION number.
java.sql.SQLException
private double executeValues(java.lang.String functionName) throws java.sql.SQLException
java.sql.SQLException
private double executeValues(java.lang.String functionName, double value) throws java.sql.SQLException
java.sql.SQLException
private double getValue(java.sql.PreparedStatement ps, double value) throws java.sql.SQLException
java.sql.SQLException
private void executeNullValues(java.lang.String functionName) throws java.sql.SQLException
java.sql.SQLException
private double executeFn(java.lang.String functionName) throws java.sql.SQLException
java.sql.SQLException
private double executeFn(java.lang.String functionName, double value) throws java.sql.SQLException
java.sql.SQLException
private void executeNullFn(java.lang.String functionName) throws java.sql.SQLException
java.sql.SQLException
private void debug(java.lang.String message)
private void debug()
public static junit.framework.Test suite()
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.