org.apache.derbyTesting.functionTests.tests.lang
Class ArithmeticTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.derbyTesting.junit.BaseTestCase
              extended by org.apache.derbyTesting.junit.BaseJDBCTestCase
                  extended by org.apache.derbyTesting.functionTests.tests.lang.ArithmeticTest
All Implemented Interfaces:
junit.framework.Test

public class ArithmeticTest
extends BaseJDBCTestCase

Test case for arithmetic.sql. It tests the arithmetic operators.


Field Summary
 
Fields inherited from class org.apache.derbyTesting.junit.BaseTestCase
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
 
Constructor Summary
ArithmeticTest(java.lang.String name)
           
 
Method Summary
private  void doBasically(java.lang.String tableName, java.lang.String type, long positiveBoundary)
          Test basic arithmetic operations.
private  void doMixedTypeImpl(java.lang.String tableName, java.lang.String type, int i)
          Test mixed types.i.e. int and bigint, or int and smallint.
private  void doOverflow(java.lang.String tableName, java.lang.String type, long positiveBoundary)
          Test overflow on some types.
static junit.framework.Test suite()
           
 void testMixedType()
          Test mixed types.i.e. int and bigint, or int and smallint.
 void testNumericDataType()
          Arithmetic on a numeric data type.
 void testPrecedenceAndAssociativity()
           
 void testTypes()
          Test arithmetic on different types.
 void testWrongType()
          Test the arithmetic operators on a type we know they don't work on.
 
Methods inherited from class org.apache.derbyTesting.junit.BaseJDBCTestCase
assertCallError, assertCheckTable, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertGetIntError, assertNextError, assertPreparedStatementError, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertTableRowCount, assertUpdateCount, assertUpdateCount, checkAllConsistency, checkEstimatedRowCount, commit, createStatement, createStatement, createStatement, dropTable, dropTable, getConnection, getDatabaseProperty, getLastSQLException, initializeConnection, openConnection, openDefaultConnection, openDefaultConnection, openUserConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, rollback, runScript, runScript, runSQLCommands, setAutoCommit, tearDown, usingDB2Client, usingDerbyNetClient, usingEmbedded
 
Methods inherited from class org.apache.derbyTesting.junit.BaseTestCase
alarm, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertSecurityManager, assertThrowableEquals, execJavaCmd, fail, getFailureFolder, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeSystemProperty, runBare, setSystemProperty, traceit
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runTest, setName, setUp, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArithmeticTest

public ArithmeticTest(java.lang.String name)
Method Detail

suite

public static junit.framework.Test suite()

testTypes

public void testTypes()
               throws java.sql.SQLException
Test arithmetic on different types. i.e. int and bigint, or int and smallint.

Throws:
java.sql.SQLException

doBasically

private void doBasically(java.lang.String tableName,
                         java.lang.String type,
                         long positiveBoundary)
                  throws java.sql.SQLException
Test basic arithmetic operations. i.e. int and bigint, or int and smallint.

Parameters:
tableName - the name of table to test. If a table with the same name has existed, it will be dropped.
type - the type to test. i.e. "smallint" or "bigint".
positiveBoundary - for "smallint", it's 32767; for "bigint", it's 9223372036854775807.
Throws:
java.sql.SQLException

doOverflow

private void doOverflow(java.lang.String tableName,
                        java.lang.String type,
                        long positiveBoundary)
                 throws java.sql.SQLException
Test overflow on some types. i.e. int and bigint, or int and smallint.

Parameters:
tableName - the name of table to test. If a table with the same name has existed, it will be dropped.
type - the type to test. i.e. "smallint" or "bigint".
positiveBoundary - for "smallint", it's 32767; for "bigint", it's 9223372036854775807.
Throws:
java.sql.SQLException

doMixedTypeImpl

private void doMixedTypeImpl(java.lang.String tableName,
                             java.lang.String type,
                             int i)
                      throws java.sql.SQLException
Test mixed types.i.e. int and bigint, or int and smallint.

Parameters:
tableName - the name of table to test.
type - the type to test. i.e. "smallint" or "bigint".
i - an integer number to test with.
Throws:
java.sql.SQLException

testMixedType

public void testMixedType()
                   throws java.sql.SQLException
Test mixed types.i.e. int and bigint, or int and smallint.

Throws:
java.sql.SQLException

testWrongType

public void testWrongType()
                   throws java.sql.SQLException
Test the arithmetic operators on a type we know they don't work on.

Throws:
java.sql.SQLException

testNumericDataType

public void testNumericDataType()
                         throws java.sql.SQLException
Arithmetic on a numeric data type.

Throws:
java.sql.SQLException

testPrecedenceAndAssociativity

public void testPrecedenceAndAssociativity()
                                    throws java.sql.SQLException
Throws:
java.sql.SQLException

Built on Sat 2009-11-28 18:44:18-0800, from revision 885187

Apache Derby V10.6 Internals - Copyright © 2004,2008 The Apache Software Foundation. All Rights Reserved.