diff options
author | Joerg Skottke [jsk] <jsk@openoffice.org> | 2010-04-19 10:46:44 +0200 |
---|---|---|
committer | Joerg Skottke [jsk] <jsk@openoffice.org> | 2010-04-19 10:46:44 +0200 |
commit | a8d19f40eea35d7077af8261629b4790bbd7eabb (patch) | |
tree | ca5b4f5591c310b64d7fddc3837d050d3b21d285 /testautomation/global/tools/includes/optional/t_listfuncs.inc | |
parent | 1240fe2a743f5795b38dea312cd031434f4e28ea (diff) |
vitomation01: #i109696 - Removed three functions from t_listfuncs.inc
Diffstat (limited to 'testautomation/global/tools/includes/optional/t_listfuncs.inc')
-rwxr-xr-x[-rw-r--r--] | testautomation/global/tools/includes/optional/t_listfuncs.inc | 227 |
1 files changed, 0 insertions, 227 deletions
diff --git a/testautomation/global/tools/includes/optional/t_listfuncs.inc b/testautomation/global/tools/includes/optional/t_listfuncs.inc index 3f766f176c2a..2a4c587a22f0 100644..100755 --- a/testautomation/global/tools/includes/optional/t_listfuncs.inc +++ b/testautomation/global/tools/includes/optional/t_listfuncs.inc @@ -29,158 +29,8 @@ '* '* short description : Replacements for routines in t_lists.inc adds some '* -'******************************************************************************* -'* -' #1 hListTestUpperBoundary ' Tests upper boundary of arrays -' #1 hListTestLowerBoundary ' Tests lower boundary of arrays -' #1 hListDelete ' Deletes one item from a list by index -' #1 hListAppend ' Append an item to a list -' #1 hManageComparisionList ' quick way to compare/create reference lists -' #1 hListFileGetSize ' find out how big an array has to be to hold the file -' #1 hListCompare ' compare two lists -' #1 hListPrependString ' Insert a string infront of each item in a list -' #1 hListAppendList ' Append one list to another -' #1 hCountMatchesInList ' Return count of occurrences of a string within a list -'* '\****************************************************************************** -' Note: These functions fix some minor bugs and introduce strict boundary -' checking for the arrays we work with. The arrays must be compatible -' to those from the "standard" list-functions. -' Why: Two reasons: -' -' 1) When working with listboxes it might happen that they are empty (bug) -' or contain more items than expected. In this case the tests would -' usually break. This is not desired as many testcases do not rely -' on the content of the listboxes. -' -' 2) This way eases the trouble of debugging huge amounts of arrays -' like those in the installation test or anywhere else where we work -' with reference lists. This is a coding help. - -'******************************************************************************* - -function hListTestUpperBoundary( aList() as string ) as boolean - - '///<h3>Verify that ListCount does not exceed upper boundary</h3> - '///<i>About listfunctions: All listfunctions rely on a special type of - '///+ array. This can be string arrays and - in some cases - numeric - '///+ arrays. What makes the arrays unique is that the first item which - '///+ has the index 0 contains the number of items in the list to be used, - '///+ anything that is stored beyond this number is ignored. This has three - '///+ consequences: 1) all listfunctions that alter an array must update - '///+ the index stored in array(0) and 2) it is possible that the index - '///+ point beyond ubound of the array which will most likely cause a - '///+ runtime error. 3) Means that arrays may only have an upper boundary - '///+ declared, all loops must start with index array(1) and must end with - '///+ index array(val( array(0))</i><br> - '///<u>Input</u>: - '///<ol> - '///+<li>List (string)</li> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Errorstatus (boolean)</li> - '///<ul> - '///+<li>TRUE: Array is ok</li> - '///+<li>FALSE: Array logic has errors</li> - '///</ul> - '///</ol> - '///<u>Description</u>: - '///<ul> - - - const CFN = "hListTestUpperBoundary::" - - dim iUpperBoundary as integer ' size according to UBOUND - dim iListSize as integer ' size according to ListCount - - dim brc as boolean - brc = true - - '///+<li>Determine the size of the array</li> - iUpperBoundary = UBOUND( aList() ) - - '///+<li>Determine the <i>claimed</i> size of the array</li> - iListSize = ListCount( aList() ) - - '///+<li>Verify that val(array(0)) <= array-size</li> - if ( iListSize > iUpperBoundary ) then - warnlog ( CFN & "List points beyound upper array boundary:" ) - printlog( CFN & "ListCount: " & iListSize ) - printlog( CFN & "UBOUND...: " & iUpperBoundary ) - brc = false - endif - - hListTestUpperBoundary() = brc - '///</ul> - -end function - -'******************************************************************************* - -function hListTestLowerBoundary( aList() as string ) as boolean - - '///<h3>Verify that the lower boundaries of an array are ok</h3> - '///<i>Prerequisite: Array compatible with those from t_lists.inc</i> - '///<i>About listfunctions: All listfunctions rely on a special type of - '///+ array. This can be string arrays and - in some cases - numeric - '///+ arrays. What makes the arrays unique is that the first item which - '///+ has the index 0 contains the number of items in the list to be used, - '///+ anything that is stored beyond this number is ignored. This has three - '///+ consequences: 1) all listfunctions that alter an array must update - '///+ the index stored in array(0) and 2) it is possible that the index - '///+ point beyond ubound of the array which will most likely cause a - '///+ runtime error. 3) Means that arrays may only have an upper boundary - '///+ declared, all loops must start with index array(1) and must end with - '///+ index array(val( array(0))</i><br> - '///<u>Input</u>: - '///<ol> - '///+<li>List (string)</li> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Errorstatus (boolean)</li> - '///<ul> - '///+<li>TRUE: Array is ok</li> - '///+<li>FALSE: Array logic has errors</li> - '///</ul> - '///</ol> - '///<u>Description</u>: - '///<ul> - - const CFN = "hListTestLowerBoundary::" - - dim iLowerBoundary as integer ' size according to LBOUND - dim iListSize as integer ' size according to ListCount - - dim brc as boolean - brc = true - - iLowerBoundary = LBOUND( aList() ) - iListSize = ListCount( aList() ) - - '///+<li>Verify that ubound for the array returns 0 (lower boundary)</li> - if ( iLowerBoundary <> 0 ) then - warnlog ( CFN & "Boundary of the array must be 0." ) - printlog( CFN & "Lower boundary is: " & iLowerBoundary ) - brc = false - endif - - '///+<li>Verify that val(array(0)) > 0</li> - if ( iListSize < 0 ) then - warnlog ( CFN & "Defined Listsize (ListCount) may never be negative" ) - printlog( CFN & "ListCount is: " & iListSize ) - brc = false - endif - - hListTestLowerBoundary() = brc - '///</ul> - -end function - -'******************************************************************************* - function hListDelete( aList() as string, iItemToDelete as integer ) as boolean '///<h3>Delete one item from a list specified by index</h3> @@ -209,20 +59,6 @@ function hListDelete( aList() as string, iItemToDelete as integer ) as boolean dim sItemToDelete as string ' The string that will be deleted dim brc as boolean ' preliminary return value - '///+<li>test array integrity: upper boundary</li> - brc = hListTestUpperBoundary( alist() ) - if ( not brc ) then - hListDelete() = brc - exit function - endif - - '///+<li>test array integrity: lower boundary</li> - brc = hListTestLowerBoundary( alist() ) - if ( not brc ) then - hListDelete() = brc - exit function - endif - '///+<li>Get some data from the arrays to work with.</li> iArraySize = ubound( aList() ) iListSizeOld = ListCount( aList() ) @@ -376,69 +212,6 @@ end function '******************************************************************************* -function hListFileGetSize( sFileIn as string ) as integer - - '///<h3>Get the number of lines from a file</h3> - '///<i>Prerequisites: Path to an existing plain text file</i> - '///<i>About listfunctions: All listfunctions rely on a special type of - '///+ array. This can be string arrays and - in some cases - numeric - '///+ arrays. What makes the arrays unique is that the first item which - '///+ has the index 0 contains the number of items in the list to be used, - '///+ anything that is stored beyond this number is ignored. This has three - '///+ consequences: 1) all listfunctions that alter an array must update - '///+ the index stored in array(0) and 2) it is possible that the index - '///+ point beyond ubound of the array which will most likely cause a - '///+ runtime error. 3) Means that arrays may only have an upper boundary - '///+ declared, all loops must start with index array(1) and must end with - '///+ index array(val( array(0))</i><br> - '///<ul> - - const CFN = "hListFileGetSize::" - const I_EXTRA_SIZE = 10 - const RC_FILE_MISSING = -1 - const RC_FILE_INVALID = -2 - - dim iFile as integer - dim sLine as string - dim iLineCount as integer : iLineCount = 0 - - '///+<li>Verify that the filename is non-empty</li> - if ( sFileIn = "" ) then - warnlog( CFN & "Invalid parameter: Filename is empty string" ) - hListFileGetSize() = RC_FILE_INVALID - exit function - endif - - '///+<li>Verify that the file exists</li> - if ( dir( sFileIn ) = "" ) then - warnlog( CFN & "File not found: " & sFileIn ) - hListFileGetSize() = RC_FILE_MISSING - exit function - endif - - '///+<li>Open the file (standard BASIC calls)</li> - iFile = freefile - open sFileIn for input as iFile - - '///+<li>Read the number of lines from the file</li> - while( not eof( iFile ) ) - - line input #iFile, sLine - iLineCount = iLineCount + 1 - - wend - - '///+<li>Close the file</li> - close #iFile - - '///+<li>Return the number of lines read or -1 on error</li> - hListFileGetSize() = iLineCount + I_EXTRA_SIZE - '///</ul> - -end function - -'******************************************************************************* - function hListCompare( aListOne() as String, aListTwo() as String ) as integer const CFN = "hListcompare::" |