Module ll_test :: Class TestLibDll
[hide private]
[frames] | no frames]

Class TestLibDll

source code


This class runs testunit test on all the function in my C linklist library.

Nested Classes [hide private]

Inherited from unittest.TestCase: failureException

Instance Methods [hide private]
 
__init__(self, name)
Initializes the TestLibDll class.
source code
 
setUp(self)
Initialize the list for each unit test.
source code
 
tearDown(self)
Destroy entire list.
source code
 
test_InfoType(self)
Check that the Info class is the correct type.
source code
 
test_sizeofList(self)
Test that the Python List object is the same size as the C List structure.
source code
 
test_DDL_Version(self)
Test that a string is returned.
source code
 
test_DLL_IsListEmpty(self)
Check that the list is empty.
source code
 
test_DLL_IsListFull(self)
Check that the list is not full.
source code
 
test_DLL_GetNumberOfRecords(self)
Check that the correct number of records are returned.
source code
 
test_DLL_SetSearchModes(self)
Check that the correct return codes are returned when setting the search modes.
source code
 
test_DLL_GetSearchModes(self)
Check that the set search modes are returned.
source code
 
test_DLL_GetCurrentIndex(self)
Check that the current index is returned.
source code
 
test_DLL_CurrentPointerToHead(self)
Check that the current pointer gets moved to the head of the list properly and that the correct return codes are returned.
source code
 
test_DLL_CurrentPointerToTail(self)
Check that the current pointer gets moved to the tail of the list properly and that the correct return codes are returned.
source code
 
test_DLL_IncrementCurrentPointer(self)
Check that the current pointer gets incremented properly and that the correct return codes are returned.
source code
 
test_DLL_DecrementCurrentPointer(self)
Check that the current pointer gets decremented properly and that the correct return codes are returned.
source code
 
test_DLL_Store_RestoreCurrentPointer(self)
Check that the store and restore of the current pointer is properly done and the correct return codes are returned.
source code
 
test_DLL_AddRecord(self)
Check that records are added to the link list properly, the index values are correct after each add, and the correct return codes are returned.
source code
 
test_DLL_InsertRecord(self)
Check that inserted records are added properly based on InsertDir, the index values are correct after each insert, and the correct return codes are returned.
source code
 
test_DLL_SwapRecord(self)
Check that the current record is swapped correctly based on InsertDir, the index values are correct after each swap, and the correct return codes are returned.
source code
 
test_DLL_UpdateCurrentRecord(self)
Check that a record gets updated correctly, the index values are correct after each update, and the correct return codes are returned.
source code
 
test_DLL_DeleteCurrentRecord(self)
Check that a record gets deleted correctly, the index values are correct after each update, and the correct return codes are returned.
source code
 
test_DLL_DeleteEntireList(self)
Check that the entire list is deleted properly, the index values are correct after the delete, and the correct return codes are returned.
source code
 
test_DLL_FindRecord(self)
Check that records are found correctly, the index values are correct after each query, and the correct return codes are returned.
source code
 
test_DLL_FindNthRecord(self)
Check that records are found correctly based on the skip value, the index values are correct after each query, and the correct return codes are returned.
source code
 
test_DLL_GetCurrentRecord(self)
Check that the current record is returned correctly, the index values are correct after the get, and the correct return codes are returned.
source code
 
test_DLL_GetPriorRecord(self)
Check that the prior record is returned correctly, the index values are correct after the get, and the correct return codes are returned.
source code
 
test_DLL_GetNextRecord(self)
Check that the next record is returned correctly, the index values are correct after the get, and the correct return codes are returned.
source code
 
test_DLL_Save_LoadList(self)
Check that the list is saved and loaded correctly, the index values are correct after the loads, the sorting on load is done properly, and the correct return codes are returned.
source code
ctypes POINTER
_initList(self, infoSize)
Prepare the link list for use and asserts that there are no APIException or FunctionException exceptions, and the list_p object is valid.
source code
 
_destroyList(self)
Executes the destroyList method and asserts that there are no APIException exceptions.
source code
 
_isListEmpty(self, test=True)
Executes the isListEmpty method, asserts that there are no APIException exceptions, and asserts that the returned value is correct.
source code
 
_isListFull(self, test=True)
Execute the isListFull method, asserts that there are no APIException exceptions, and asserts that the return value is correct.
source code
 
_getNumberOfRecords(self, test=0)
Execute the getNumberOfRecords method, asserts that there are no APIException exceptions, and asserts that the returned value is correct.
source code
 
_setSearchModes(self, origin, dir, result=0)
Execute the setSearchModes method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.
source code
 
_getSearchModes(self, test=(1, 1))
Execute the getSearchModes method, asserts that there are no APIException exceptions, and asserts that the returned tuple is correct.
source code
 
_getCurrentIndex(self, test=0)
Execute the getCurrentIndex method, asserts that there are no APIException exceptions, and asserts that the returned value is correct.
source code
 
_currentPointerToHead(self, result=0)
Execute the currentPointerToHead method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.
source code
 
_currentPointerToTail(self, result=0)
Execute the currentPointerToTail method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.
source code
 
_incrementCurrentPointer(self, result=0)
Execute the incrementCurrentPointer method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.
source code
 
_decrementCurrentPointer(self, result=0)
Execute the decrementCurrentPointer method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.
source code
 
_storeCurrentPointer(self, result=0)
Execute the storeCurrentPointer method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.
source code
 
_restoreCurrentPointer(self, result=0)
Execute the restoreCurrentPointer method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.
source code
 
_addRecord(self, info, pFun=None, result=0)
Execute the addRecord method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.
source code
 
_insertRecord(self, info, dir, result=0)
Execute the insertRecord method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.
source code
 
_swapRecord(self, dir, result=0)
Execute the swapRecord method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.
source code
 
_updateCurrentRecord(self, record, result=0)
Execute the updateCurrentRecord method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.
source code
 
_deleteCurrentRecord(self, result=0)
Execute the method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.
source code
 
_deleteEntireList(self, result=0)
Execute the deleteAllNodes method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.
source code
 
_findRecord(self, record, match, pFun=None, result=0)
Execute the findRecord method, asserts that there are no APIException or FunctionException exceptions, assert that the test value is correct, and asserts that the return code is correct.
source code
 
_findNthRecord(self, record, skip, test='', result=0)
Execute the findNthRecord method, asserts that there are no APIException or FunctionException exceptions, assert that the test value is correct, and asserts that the return code is correct.
source code
 
_getCurrentRecord(self, record, test='', result=0)
Execute the getCurrentRecord method, asserts that there are no APIException or FunctionException exceptions, assert that the test value is correct, and asserts that the return code is correct.
source code
 
_getPriorRecord(self, record, test='', result=0)
Execute the getPriorRecord method, asserts that there are no APIException or FunctionException exceptions, assert that the test value is correct, and asserts that the return code is correct.
source code
 
_getNextRecord(self, record, test='', result=0)
Execute the getNextRecord method, asserts that there are no APIException or FunctionException exceptions, assert that the test value is correct, and asserts that the return code is correct.
source code
 
_saveList(self, path, result=0)
Execute the saveList method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.
source code
 
_loadList(self, path, pFun=None, result=0)
Execute the loadList method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.
source code

Inherited from unittest.TestCase: __call__, __eq__, __hash__, __ne__, __repr__, __str__, assertAlmostEqual, assertAlmostEquals, assertEqual, assertEquals, assertFalse, assertNotAlmostEqual, assertNotAlmostEquals, assertNotEqual, assertNotEquals, assertRaises, assertTrue, assert_, countTestCases, debug, defaultTestResult, fail, failIf, failIfAlmostEqual, failIfEqual, failUnless, failUnlessAlmostEqual, failUnlessEqual, failUnlessRaises, id, run, shortDescription

Inherited from unittest.TestCase (private): _exc_info

Inherited from object: __delattr__, __format__, __getattribute__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, name)
(Constructor)

source code 

Initializes the TestLibDll class.

  1. Call the constructor of the base class.
  2. Create an aggreget of the DLinklist class.
  3. Define an object to be used for a ctypes POINTER object.
Parameters:
  • name - The name used by the TestCase class.
Raises:
Overrides: object.__init__

setUp(self)

source code 

Initialize the list for each unit test.

Returns:
None
Overrides: unittest.TestCase.setUp

tearDown(self)

source code 

Destroy entire list.

Returns:
None
Overrides: unittest.TestCase.tearDown

test_InfoType(self)

source code 

Check that the Info class is the correct type.

Returns:
None

test_sizeofList(self)

source code 

Test that the Python List object is the same size as the C List structure.

Returns:
None

test_DDL_Version(self)

source code 

Test that a string is returned.

The C function doc string:

 Ver: 1.3.0  Dec 24 2011
 -------------------------------
 Developed by: Carl J. Nobile
 Contributions: Charlie Buckheit
                Graham Inchley
                Wai-Sun Chia
                Mark M. Feenstra
                Lianqi Qiu
Returns:
None

test_DLL_IsListEmpty(self)

source code 

Check that the list is empty.

Returns:
None

test_DLL_IsListFull(self)

source code 

Check that the list is not full.

Returns:
None

test_DLL_GetNumberOfRecords(self)

source code 

Check that the correct number of records are returned.

Returns:
None

test_DLL_SetSearchModes(self)

source code 

Check that the correct return codes are returned when setting the search modes.

Returns:
None

test_DLL_GetSearchModes(self)

source code 

Check that the set search modes are returned.

Returns:
None

test_DLL_GetCurrentIndex(self)

source code 

Check that the current index is returned.

Returns:
None

test_DLL_CurrentPointerToHead(self)

source code 

Check that the current pointer gets moved to the head of the list properly and that the correct return codes are returned.

Returns:
None

test_DLL_CurrentPointerToTail(self)

source code 

Check that the current pointer gets moved to the tail of the list properly and that the correct return codes are returned.

Returns:
None

test_DLL_IncrementCurrentPointer(self)

source code 

Check that the current pointer gets incremented properly and that the correct return codes are returned.

Returns:
None

test_DLL_DecrementCurrentPointer(self)

source code 

Check that the current pointer gets decremented properly and that the correct return codes are returned.

Returns:
None

test_DLL_Store_RestoreCurrentPointer(self)

source code 

Check that the store and restore of the current pointer is properly done and the correct return codes are returned.

Returns:
None

test_DLL_AddRecord(self)

source code 

Check that records are added to the link list properly, the index values are correct after each add, and the correct return codes are returned.

Returns:
None

test_DLL_InsertRecord(self)

source code 

Check that inserted records are added properly based on InsertDir, the index values are correct after each insert, and the correct return codes are returned.

Returns:
None

test_DLL_SwapRecord(self)

source code 

Check that the current record is swapped correctly based on InsertDir, the index values are correct after each swap, and the correct return codes are returned.

Returns:
None

test_DLL_UpdateCurrentRecord(self)

source code 

Check that a record gets updated correctly, the index values are correct after each update, and the correct return codes are returned.

Returns:
None

test_DLL_DeleteCurrentRecord(self)

source code 

Check that a record gets deleted correctly, the index values are correct after each update, and the correct return codes are returned.

Returns:
None

test_DLL_DeleteEntireList(self)

source code 

Check that the entire list is deleted properly, the index values are correct after the delete, and the correct return codes are returned.

Returns:
None

test_DLL_FindRecord(self)

source code 

Check that records are found correctly, the index values are correct after each query, and the correct return codes are returned.

Returns:
None

test_DLL_FindNthRecord(self)

source code 

Check that records are found correctly based on the skip value, the index values are correct after each query, and the correct return codes are returned.

Returns:
None

test_DLL_GetCurrentRecord(self)

source code 

Check that the current record is returned correctly, the index values are correct after the get, and the correct return codes are returned.

Returns:
None

test_DLL_GetPriorRecord(self)

source code 

Check that the prior record is returned correctly, the index values are correct after the get, and the correct return codes are returned.

Returns:
None

test_DLL_GetNextRecord(self)

source code 

Check that the next record is returned correctly, the index values are correct after the get, and the correct return codes are returned.

Returns:
None

test_DLL_Save_LoadList(self)

source code 

Check that the list is saved and loaded correctly, the index values are correct after the loads, the sorting on load is done properly, and the correct return codes are returned.

Returns:
None

_initList(self, infoSize)

source code 

Prepare the link list for use and asserts that there are no APIException or FunctionException exceptions, and the list_p object is valid.

Parameters:
  • infoSize (int) - The size in bytes of the user defined Info class.
Returns: ctypes POINTER
A pinter to the link list.

_destroyList(self)

source code 

Executes the destroyList method and asserts that there are no APIException exceptions.

Returns:
None

_isListEmpty(self, test=True)

source code 

Executes the isListEmpty method, asserts that there are no APIException exceptions, and asserts that the returned value is correct.

Parameters:
  • test (bool) - The expected value, the default is True.
Returns:
None

_isListFull(self, test=True)

source code 

Execute the isListFull method, asserts that there are no APIException exceptions, and asserts that the return value is correct.

Parameters:
  • test (bool) - The expected value, the default is True.
Returns:
None

_getNumberOfRecords(self, test=0)

source code 

Execute the getNumberOfRecords method, asserts that there are no APIException exceptions, and asserts that the returned value is correct.

Parameters:
  • test (int) - The expected value, the default is 0.
Returns:
None

_setSearchModes(self, origin, dir, result=0)

source code 

Execute the setSearchModes method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.

Parameters:
  • result (Return) - The expected value, the default is Return.NORMAL.
Returns:
None

_getSearchModes(self, test=(1, 1))

source code 

Execute the getSearchModes method, asserts that there are no APIException exceptions, and asserts that the returned tuple is correct.

Parameters:
  • test (tuple of SrchOrigin and SrchDir) - The expected value, the default is (SrchOrigin.HEAD, SrchDir.DOWN).
Returns:
None

_getCurrentIndex(self, test=0)

source code 

Execute the getCurrentIndex method, asserts that there are no APIException exceptions, and asserts that the returned value is correct.

Parameters:
  • test (int) - The expected value, the default is 0.
Returns:
None

_currentPointerToHead(self, result=0)

source code 

Execute the currentPointerToHead method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.

Parameters:
  • result (Return) - The expected value, the default is Return.NORMAL.
Returns:
None

_currentPointerToTail(self, result=0)

source code 

Execute the currentPointerToTail method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.

Parameters:
  • result (Return) - The expected value, the default is Return.NORMAL.
Returns:
None

_incrementCurrentPointer(self, result=0)

source code 

Execute the incrementCurrentPointer method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.

Parameters:
  • result (Return) - The expected value, the default is Return.NORMAL.
Returns:
None

_decrementCurrentPointer(self, result=0)

source code 

Execute the decrementCurrentPointer method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.

Parameters:
  • result (Return) - The expected value, the default is Return.NORMAL.
Returns:
None

_storeCurrentPointer(self, result=0)

source code 

Execute the storeCurrentPointer method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.

Parameters:
  • result (Return) - The expected value, the default is Return.NORMAL.
Returns:
None

_restoreCurrentPointer(self, result=0)

source code 

Execute the restoreCurrentPointer method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.

Parameters:
  • result (Return) - The expected value, the default is Return.NORMAL.
Returns:
None

_addRecord(self, info, pFun=None, result=0)

source code 

Execute the addRecord method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.

Parameters:
  • info (Info) - An instance of the Info class.
  • pFun (ctypes CFUNCTYPE) - An optional compare function, the default is None.
  • result (Return) - The expected value, the default is Return.NORMAL.
Returns:
None

_insertRecord(self, info, dir, result=0)

source code 

Execute the insertRecord method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.

Parameters:
  • info (Info) - An instance of the Info class.
  • dir (InsertDir) - The direction to insert indicator.
  • result (Return) - The expected value, the default is Return.NORMAL.
Returns:
None

_swapRecord(self, dir, result=0)

source code 

Execute the swapRecord method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.

Parameters:
  • dir (InsertDir) - The direction to swap indicator.
  • result (Return) - The expected value, the default is Return.NORMAL.
Returns:
None

_updateCurrentRecord(self, record, result=0)

source code 

Execute the updateCurrentRecord method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.

Parameters:
  • record (Info) - Will contains the results of the get.
  • result (Return) - The expected value, the default is Return.NORMAL.
Returns:
None

_deleteCurrentRecord(self, result=0)

source code 

Execute the method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.

Parameters:
  • result (Return) - The expected value, the default is Return.NORMAL.
Returns:
None

_deleteEntireList(self, result=0)

source code 

Execute the deleteAllNodes method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.

Parameters:
  • result (Return) - The expected value, the default is Return.NORMAL.
Returns:
None

_findRecord(self, record, match, pFun=None, result=0)

source code 

Execute the findRecord method, asserts that there are no APIException or FunctionException exceptions, assert that the test value is correct, and asserts that the return code is correct.

Parameters:
  • record (Info) - Will contain the results of the find.
  • match (Info) - Provides the query information.
  • pFun (ctypes CFUNCTYPE) - An optional compare function, the default is None.
  • result (Return) - The expected value, the default is Return.NORMAL.
Returns:
None

_findNthRecord(self, record, skip, test='', result=0)

source code 

Execute the findNthRecord method, asserts that there are no APIException or FunctionException exceptions, assert that the test value is correct, and asserts that the return code is correct.

Parameters:
  • record (Info) - Will contain the results of the find.
  • skip (int) - The number of records to skip over.
  • test (str) - Value to test, default is an empty string.
  • result (Return) - The expected value, the default is Return.NORMAL.
Returns:
None

_getCurrentRecord(self, record, test='', result=0)

source code 

Execute the getCurrentRecord method, asserts that there are no APIException or FunctionException exceptions, assert that the test value is correct, and asserts that the return code is correct.

Parameters:
  • record (Info) - Will contain the results of the find.
  • test (str) - Value to test, default is an empty string.
  • result (Return) - The expected value, the default is Return.NORMAL.
Returns:
None

_getPriorRecord(self, record, test='', result=0)

source code 

Execute the getPriorRecord method, asserts that there are no APIException or FunctionException exceptions, assert that the test value is correct, and asserts that the return code is correct.

Parameters:
  • record (Info) - Will contain the results of the find.
  • test (str) - Value to test, default is an empty string.
  • result (Return) - The expected value, the default is Return.NORMAL.
Returns:
None

_getNextRecord(self, record, test='', result=0)

source code 

Execute the getNextRecord method, asserts that there are no APIException or FunctionException exceptions, assert that the test value is correct, and asserts that the return code is correct.

Parameters:
  • record (Info) - Will contain the results of the find.
  • test (str) - Value to test, default is an empty string.
  • result (Return) - The expected value, the default is Return.NORMAL.
Returns:
None

_saveList(self, path, result=0)

source code 

Execute the saveList method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.

Parameters:
  • path (str) - The full path to the data file.
  • result (Return) - The expected value, the default is Return.NORMAL.
Returns:
None

_loadList(self, path, pFun=None, result=0)

source code 

Execute the loadList method, asserts that there are no APIException or FunctionException exceptions, and asserts that the return code is correct.

Parameters:
  • path (str) - The full path to the data file.
  • pFun (ctypes CFUNCTYPE) - An optional compare function, the default is None.
  • result (Return) - The expected value, the default is Return.NORMAL.
Returns:
None