home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PowerPlay 1997 March
/
PowerPlay0397.iso
/
T-ONLINE
/
SHOW
/
XTRAS
/
FFXTRAS
/
-FFVERIF.DIR
/
00002_Script_performTests
< prev
next >
Wrap
Text File
|
1996-03-15
|
26KB
|
879 lines
on startMovie
global dgBlueColor, dgYellowColor
global dgMonospace, dgMonosize
put empty into field "mmsg"
put empty into field "iteration"
set the text of cast "testName" to EMPTY
if the machineType = 256 then
put "Courier New" into dgMonospace
put 10 into dgMonosize
else
put "Monaco" into dgMonospace
put 9 into dgMonosize
end if
put the foreColor of member "blueModel" into dgBlueColor
put the foreColor of member "yellowModel" into dgYellowColor
put the foreColor of member "dkBlueModel" into dgDkBlueColor
set the textHeight of member "mmsg" to 11
set the textFont of member "mmsg" to dgMonospace
set the textSize of member "mmsg" to dgMonosize
set the foreColor of member "mmsg" to dgYellowColor
set the textFont of member "testName" to "Helvetica"
set the textSize of member "testName" to 9
set the foreColor of member "testName" to dgYellowColor
put "0" into field "iteration"
set the textFont of member "iteration" to "Helvetica"
set the textSize of member "iteration" to 9
set the foreColor of member "iteration" to dgBlueColor
end startMovie
on closeWindow
put the windowList into theList
repeat with i = 1 to count(theList)
put string(getAt(theList,i)) into theItem
delete word 1 of theItem
delete char 1 of theItem
put the number of chars of theItem into theChar
delete char theChar-1 to theChar of theItem
if (theItem contains "Validation Suite") or (theItem contains "FFVERIF") then
forget window theItem
end if
end repeat
tell the stage to puppetPalette 0
tell the stage to updateStage
end closeWindow
on performTests
-----------------------------------------------------------------
-- Initializing the test
-----------------------------------------------------------------
global gDBActive1030
global dgBlueColor, dgYellowColor
global dgMonospace, dgMonosize
if gDBActive1030 = "true" then
put DBCloseSession() into DBResult
if DBResult < 0 then
tmsg "==== Session was active. DBCloseSession reset failed."
tFail
end if
end if
-----------------------------------------------------------------
put dgBlueColor into blueHold
put dgYellowColor into yellowHold
put dgMonospace into monoHold
put dgMonosize into monoSize
clearGlobals
global dgBlueColor
global dgYellowColor
global dgMonospace, dgMonosize
put blueHold into dgBlueColor
put yellowHold into dgYellowColor
put monoHold into dgMonospace
put monoSize into dgMonosize
global verboseTest
put false into verboseTest
-----------------------------------------------------------------
put empty into field "iteration"
put empty into field "mmsg"
put DBVersion() & return into field "mmsg"
set the textFont of member "mmsg" to dgMonospace
set the textSize of member "mmsg" to dgMonosize
set the textHeight of member "mmsg" to 11
set the foreColor of member "mmsg" to dgYellowColor
put the freebytes into origMasterBytes
put the freeBlock into origMasterBlock
-----------------------------------------------------------------
-- Begin the tests
-----------------------------------------------------------------
tXtraTest
set the textFont of member "testName" to "Helvetica"
set the textSize of member "testName" to 9
set the foreColor of member "testName" to dgBlueColor
set the textFont of member "iteration" to "Helvetica"
set the textSize of member "iteration" to 9
set the foreColor of member "iteration" to dgBlueColor
tGlobalVariables
tDBOpenSession
tDBCloseSession
tDBOpenSessionStressTest
tDBOpenSession -- for the rest of the tests
tDBUse "VIDEO.DBF"
tDBClose "1"
tDBDatabaseExists "VIDEO.DBF"
tDBUse "VIDEO.DBF"
tDBCloseAll
--
-- Using VIDEO DBF
tDBUse "VIDEO.DBF"
tDBListFields
tDBCount
tDBBottom
tDBCurrRecNum 31
tDBTop
tDBCurrRecNum 1
tDBGo
tDBCurrRecNum 18
tRetrieveChar
tRetrieveNum
tRetrieveLogical
tRetrieveDate
tRetrieveMemo
tDBGetCurrRecValG
tDBSum
tDBCloseAll
tDBUse "VIDEO.DBF"
tDBLocate
tDBClose "1"
tDBUse "VIDEO.DBF"
tDBCreateIndex
tDBCheckIndex
tDBReindex
tDBSeek
tDBClose "1"
--
-- using DATA01
tDBCreate
tDBWriteRecG
tDBFindMemo
tDBZapRecs
tDBWriteRecX
tDBZapRecs
tDBCloseAll
tDBEncrypt
tDBCreateMany
tDBCloseAll
tDBWriteRecManyX
tDBCloseSession
-----------------------------------------------------------------
put "" into field "iteration"
put the freeBytes into newBytes
put origMasterBytes - newBytes into theBytes
tmsg "== End of test sequence:"
tmsg "==== Overall test consumed" && theBytes && "bytes."
tmsg "==== The largest contiguous free block at start"
tmsg "==== was" && origMasterBlock && "bytes."
tmsg ""
tmsg "==== The largest contiguous remaining free block"
tmsg "==== is" && the freeBlock && "bytes."
tmsg ""
tmsg ""
put empty into field "iteration"
set the text of cast "testName" to EMPTY
beep
end performTests
----------------------------------------------------------------------------------------------------------------------------------
------------------------ TEST ROUTINE SEGMENT --------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------
-- Calling the Xtra test
-----------------------------------------------------------------
on tXtraTest
global dgBlueColor
put empty into field "iteration"
put field "iterations" into max
tTest "Loading of Xtra"
repeat with i = 1 to max
put DBVersion() into dummy
put i into field "iteration"
set the textFont of member "iteration" to "Helvetica"
set the textSize of member "iteration" to 9
set the foreColor of member "iteration" to dgBlueColor
end repeat
tPass
end tXtraTest
-----------------------------------------------------------------
-- Code to test interface to global variables
-----------------------------------------------------------------
on tGlobalVariables
global dgBlueColor
put field "iterations" into max
put "" into field "iteration"
tTest "Global Variable Interface"
global testGlobal1, testGlobal2
global theLong, theDouble
put false into testFail
repeat with i = 1 to max
put DBSetGlobal("testGlobal1","TestData") into dummy
put DBSetGlobal("testGlobal2","Test2Data") into dummy
-- this tests to make sure we can read a global that's not most recent
put DBGetGlobal("testGlobal1") into theGlob1
if theGlob1 <> "TestData" then
tmsg return & "==== testGlobal1 returned" && theGlob1
put true into testFail
exit repeat
end if
put DBGetGlobal("testGlobal2") into theGlob2
if theGlob2 <> "Test2Data" then
tmsg return & "==== testGlobal2 returned" && theGlob2
put true into testFail
exit repeat
end if
put 896 into theLong
put 493.22 into theDouble
put dbGetGlobal("theLong") into theLongResult
if theLongResult <> 896 then
put true into testFail
exit repeat
end if
put dbGetGlobal("theDouble") into theDoubleResult
if string(theDoubleResult) <> "493.22" then
put true into testFail
exit repeat
end if
put i into field "iteration"
set the textFont of member "iteration" to "Helvetica"
set the textSize of member "iteration" to 9
set the foreColor of member "iteration" to dgBlueColor
end repeat
if testFail = true then
tFail
exit
else
tPass
end if
end tGlobalVariables
-----------------------------------------------------------------
-- DBOpenSession
-----------------------------------------------------------------
on tDBOpenSession
tTest "DBOpenSession"
put DBOpenSession() into DBResult
if DBResult = 0 then
tPass
else
tmsg "== DBOpenSession returned" && DBResult & "."
tFail
exit
end if
end tDBOpenSession
-----------------------------------------------------------------
-- DBCloseSession
-----------------------------------------------------------------
on tDBCloseSession
tTest "DBCloseSession"
put DBCloseSession() into DBResult
if DBResult = 0 then
tPass
else
tmsg "== DBCloseSession returned" && DBResult & "."
tFail
exit
end if
end tDBCloseSession
-----------------------------------------------------------------
-- DBOpenSession stress test
-----------------------------------------------------------------
on tDBOpenSessionStressTest
global dgBlueColor
tTest "DBOpenSession/DBCloseSession Stress"
put field "iterations" into max
put "" into field "iteration"
repeat with i = 1 to max
put i into field "iteration"
set the textFont of member "iteration" to "Helvetica"
set the textSize of member "iteration" to 9
set the foreColor of member "iteration" to dgBlueColor
put DBOpenSession() into DBResult
if DBResult < 0 then
tmsg "==== DBOpenSession returned" && DBResult & ". (failed)"
tFail
exit
end if
put DBCloseSession() into DBResult
if DBResult < 0 then
tmsg "==== DBCloseSession returned" && DBResult & ". (failed)"
tFail
exit
end if
end repeat
tPass
end tDBOpenSessionStressTest
-----------------------------------------------------------------
-- DBUse test
-----------------------------------------------------------------
on tDBUse theFile
-- expects original VIDEO.DBF/VIDEO.DBT
tTest "DBUse"
if the machineType <> 256 then
put the moviePath & "Test Data:" & theFile into theDBFile
else
put the moviePath & "TESTDATA\" & theFile into theDBFile
end if
put DBUse(theDBFile) into videoID
if videoID < 0 then
tmsg "==== DBUse returned" && videoID & ". (failed)"
tFail
exit
else
tPass
end if
end tDBUse
-----------------------------------------------------------------
-- DBClose test
-----------------------------------------------------------------
on tDBClose videoID
-- expects previous DBUse to have passed
tTest "DBClose"
put DBClose(videoID) into DBResult
if videoID < 0 then
tmsg "==== DBClose returned" && videoID & ". (failed)"
tFail
exit
else
tPass
end if
end tDBClose
-----------------------------------------------------------------
-- DBDatabaseExists test
-----------------------------------------------------------------
on tDBDatabaseExists theFile
tTest "DBDatabaseExists"
if the machineType <> 256 then
put the moviePath & "Test Data:" & theFile into theDBFile
else
put the moviePath & "TESTDATA\" & theFile into theDBFile
end if
put DBDatabaseExists(theDBFile) into theID
if theID < 0 then
tmsg "==== DBDatabaseExists returned" && theID & ". (failed)"
tFail
exit
end if
put DBDatabaseExists("nosuchfile") into theID
if theID >= 0 then
tmsg "==== DBDatabaseExists returned" && theID & ". (failed)"
tFail
exit
end if
tPass
end tDBDatabaseExists
-----------------------------------------------------------------
-- DBCloseAll test
-----------------------------------------------------------------
on tDBCloseAll
-- expects previous DBUse to have passed
tTest "DBCloseAll on one open database"
put DBCloseAll() into DBResult
if DBResult < 0 then
tmsg "==== DBCloseAll returned" && DBResult & ". (failed)"
tFail
exit
else
tPass
end if
end tDBCloseAll
-----------------------------------------------------------------
-- DBListFields test
-----------------------------------------------------------------
on tDBListFields
-- expects original VIDEO.DBF/VIDEO.DBT and
-- an unmucked-with cast member videoDBFschema
tTest "DBListFields (for one file)"
put DBListFields() into theFields
if theFields <> field "videoDBFschema" then
tFail
exit
else
tPass
end if
end tDBListFields
-----------------------------------------------------------------
-- DBCount test
-----------------------------------------------------------------
on tDBCount
-- expects original VIDEO.DBF/VIDEO.DBT
tTest "DBCount"
put DBCount() into theCount
if theCount <> 31 then
tFail
exit
else
tPass
end if
end tDBCount
-----------------------------------------------------------------
-- DBBottom test
-----------------------------------------------------------------
on tDBBottom
-- expects original VIDEO.DBF/VIDEO.DBT
tTest "DBBottom"
put DBBottom() into theResult
if theResult < 0 then
tmsg "==== DBBottom returned" && theResult & ". (failed)"
tFail
exit
else
tPass
end if
end tDBBottom
-----------------------------------------------------------------
-- DBCurrRecNum test
-----------------------------------------------------------------
on tDBCurrRecNum theNum
-- expects original VIDEO.DBF/VIDEO.DBT
tTest "DBCurrRecNum"
put DBCurrRecNum() into theResult
if theResult <> theNum then
tFail
exit
else
tPass
end if
end
-----------------------------------------------------------------
-- DBTop test
-----------------------------------------------------------------
on tDBTop
-- expects original VIDEO.DBF/VIDEO.DBT
tTest "DBTop"
put DBTop() into theResult
if theResult < 0 then
tmsg "==== DBTop returned" && theResult & ". (failed)"
tFail
exit
else
tPass
end if
end tDBTop
-----------------------------------------------------------------
-- DBLocate test
-----------------------------------------------------------------
on tDBLocate
-- expects original VIDEO.DBF/VIDEO.DBT
tTest "DBLocate"
put DBTop() into theResult
put DBLocate("TITLE = 'GHOSTBUSTERS'") into DBResult
if DBResult <> 0 then
tFail
else
if DBCurrRecNum() <> 21 then
tFail
else
tPass
end if
end if
put DBTop() into dummy
end tDBLocate
-----------------------------------------------------------------
-- DBGo test
-----------------------------------------------------------------
on tDBGo
-- expects original VIDEO.DBF/VIDEO.DBT
tTest "DBGo"
put DBGo(18) into theResult
if theResult < 0 then
tmsg "==== DBGo returned" && theResult & ". (failed)"
tFail
exit
else
tPass
end if
end tDBGo
-----------------------------------------------------------------
-- Retrieve character field test
-----------------------------------------------------------------
on tRetrieveChar
tTest "Retrieve Character (C) field"
put DBGetFieldByName("TITLE") into theResult
if theResult <> "A NIGHTMARE ON ELM STREET" then
tFail
exit
else
tPass
end if
end tRetrieveChar
-----------------------------------------------------------------
-- Retrieve numeric field test
-----------------------------------------------------------------
on tRetrieveNum
tTest "Retrieve Numeric (N) field"
put DBGetFieldByName("COST_BUY") into theResult
if theResult <>29.95 then
tFail
exit
else
tPass
end if
end tRetrieveNum
-----------------------------------------------------------------
-- Retrieve logical field test
-----------------------------------------------------------------
on tRetrieveLogical
tTest "Retrieve Logical (L) field"
put DBGetFieldByName("AVAILABLE") into theResult
if theResult <> "F" then
tFail
exit
else
tPass
end if
end tRetrieveLogical
-----------------------------------------------------------------
-- Retrieve date field test
-----------------------------------------------------------------
on tRetrieveDate
tTest "Retrieve Date (D) field"
put DBGetFieldByName("DATE_ARRIV") into theResult
if theResult <> "19860314" then
tFail
exit
else
tPass
end if
end tRetrieveDate
-----------------------------------------------------------------
-- Retrieve memo field test
-----------------------------------------------------------------
on tRetrieveMemo
tTest "DBGetMemo"
put DBGetMemo("DESCRIPT") into theResult
if theResult <> the text of cast "testMemoData" then
tFail
exit
else
tPass
end if
end tRetrieveMemo
-----------------------------------------------------------------
-- DBSum test
-----------------------------------------------------------------
on tDBSum
tTest "DBSum"
put the floatPrecision into fp
set the floatPrecision to 2
put DBSum("COST_RENT") into theResult
if theResult <> 98.95 then
tFail
else
put DBSum("COST_BUY") into theResult
if theResult <> 984.52 then
tFail
else
tPass
end if
end if
set the floatPrecision to fp
end tDBSum
-----------------------------------------------------------------
-- DBGetCurrRecVal("G") test
-----------------------------------------------------------------
on tDBGetCurrRecValG
tTest "DBGetCurrRecVal(G)"
put DBGetCurrRecVal("G") into theResult
global TITLE, COST_BUY, AVAILABLE, DATE_ARRIV, DESCRIPT
if TITLE <> "A NIGHTMARE ON ELM STREET" then
tmsg "==== DBGetCurrRecVal(G) character data mismatch. (failed)"
tFail
exit
end if
if COST_BUY <> 29.95 then
tmsg "==== DBGetCurrRecVal(G) numeric data mismatch. (failed)"
tFail
exit
end if
if AVAILABLE <> "F" then
tmsg "==== DBGetCurrRecVal(G) logical data mismatch. (failed)"
tFail
exit
end if
if DATE_ARRIV <> "19860314" then
tmsg "==== DBGetCurrRecVal(G) date data mismatch. (failed)"
tFail
exit
end if
if DESCRIPT <> the text of cast "testMemoData" then
tmsg "==== DBGetCurrRecVal(G) memo data mismatch. (failed)"
tFail
exit
end if
tPass
end tDBGetCurrRecValG
-----------------------------------------------------------------
-- DBCreate test
-----------------------------------------------------------------
on tDBCreate
tTest "DBCreate"
put "CHAR_FLD,C,25" into schema
put return & "NUM_FLD,N,8,3" after schema
put return & "MEMO_FLD,M" after schema
put the moviePath & "TEST01" into theDBFile
if the machineType <> 256 then
put the moviePath & "Test Data:TEST01" into theDBFile
else
put the moviePath & "TESTDATA\TEST01" into theDBFile
end if
put DBCreate(theDBFile,3,schema,"false") into dbResult
if dbResult < 0 then
tmsg "==== dbResult returned" && dbResult & ". (failed)"
tFail
exit
end if
put DBCloseAll() into DBResult
if DBResult < 0 then
tmsg "==== DBCloseAll returned" && DBResult & ". (failed)"
tFail
exit
end if
put DBUse(theDBFile) into videoID
if videoID < 0 then
tmsg "==== DBUse returned" && videoID & ". (failed)"
tFail
exit
end if
put DBListFields() into theFields
put "3" & return & "CHAR_FLD,C,25,0" into fieldCheck
put return & "NUM_FLD,N,8,3" after fieldCheck
put return & "MEMO_FLD,M,10,0" & return after fieldCheck
if theFields <> fieldCheck then
tmsg "==== DBCreate's fields don't match . (failed)"
tFail
exit
end if
tPass
end tDBCreate
-----------------------------------------------------------------
-- DBWriteRec(G)
-----------------------------------------------------------------
on tDBWriteRecG
global dgBlueColor
put field "iterations" into max
put "" into field "iteration"
tTest "DBWriteRec(G)"
global CHAR_FLD, NUM_FLD, MEMO_FLD
repeat with i = 1 to max
set the textFont of member "iteration" to "Helvetica"
set the textSize of member "iteration" to 9
set the foreColor of member "iteration" to dgBlueColor
put i into field "iteration"
put string(integer(i)) into NUM_FLD
put "Loop [" & integer(i) & "]" into CHAR_FLD
put "[" & integer(i) & "]" && the text of cast "testMemoData" into MEMO_FLD
put DBCurrRecNum() + 1 into theRec
put DBWriteRec("G", theRec) into DBResult
if DBResult < 0 then
tmsg "==== DBWriteRec(G) returned" && DBResult & ". (failed)"
tFail
exit
end if
end repeat
put DBCount() into numRecs
if numRecs <> max then
tmsg "==== DBWriteRec(G) had wrong total record count. (failed)"
tFail
exit
end if
repeat with i = max down to 1
put integer(i) into field "iteration"
put DBGo(i) into DBResult
if DBResult < 0 then
tmsg "==== DBGo returned" && DBResult & ". (failed)"
tFail
exit
end if
put "" into CHAR_FLD
put "" into NUM_FLD
put "" into MEMO_FLD
put DBGetCurrRecVal("G") into DBResult
put i into NUM_FLDx
put "Loop [" &integer(i) & "]" into CHAR_FLDx
put "[" &integer(i) & "]" && the text of cast "testMemoData" into MEMO_FLDx
if NUM_FLDx <> NUM_FLD then
tmsg ""
tmsg "==== Numeric data retrieval mismatch. (failed)"
tmsg "==== NUM_FLD is [" & NUM_FLD & "]."
tmsg "==== NUM_FLD should be [" & NUM_FLDx & "]."
tFail
exit
end if
if CHAR_FLDx <> CHAR_FLD then
tmsg "==== Character data retrieval mismatch. (failed)"
tmsg "==== CHAR_FLD is [" & CHAR_FLD & "]."
tmsg "==== CHAR_FLD should be [" & CHAR_FLDx & "]."
tFail
exit
end if
if MEMO_FLDx <> MEMO_FLD then
tmsg "==== Memo data retrieval mismatch. (failed)"
tFail
exit
end if
end repeat
tPass
end tDBWriteRecG
-----------------------------------------------------------------
-- DBFindMemo
-----------------------------------------------------------------
on tDBFindMemo
put field "iterations" into max
if max > 20 then
tTest "DBFindMemo"
put DBTop() into DBResult
put "[18] Starring" into searchStr
put DBFindMemo("MEMO_FLD", searchStr) into DBResult
if DBResult < 0 then
tFail
else
if DBCurrRecNum() <> 18 then
tFail
else
tPass
end if
end if
end if
end tDBFindMemo
-----------------------------------------------------------------
-- DBZapRecs
-----------------------------------------------------------------
on tDBZapRecs
put "" into field "iteration"
tTest "DBZapRecs"
put DBCount() into theCount
if theCount <> field "iterations" then
tmsg "==== Incorrect record count. (failed)"
tFail
exit
end if
put DBZapRecs(1,theCount) into DBResult
if DBResult < 0 then
tFail
exit
end if
tPass
end tDBZapRecs
-----------------------------------------------------------------
-- DBEncrypt
-----------------------------------------------------------------
on tDBEncrypt
tTest "DBEncrypt/DBDecrypt"
put "This is a test" into theS
put DBEncrypt(theS,"mykey") into theEncryptS
put DBDecrypt(theEncryptS,"mykey") into theS2
if theS <> theS2 then
tFail
else
tPass
end if
end tDBEncrypt
-----------------------------------------------------------------
-- DBCreateIndex
-----------------------------------------------------------------
on tDBCreateIndex
tTest "DBCreateIndex"
if the machineType <> 256 then
put the moviePath & "Test Data:VIDNAME" into theDBFile
else
put the moviePath & "TESTDATA\VIDNAME" into theDBFile
end if
put DBCreateIndex(theDBFile,"UPPER(TITLE)","0","0") into indexID
if indexID < 0 then
tFail
else
put DBCloseIndex(indexID) into DBResult
if DBResult < 0 then
tFail
else
tPass
end if
end if
end tDBCreateIndex
-----------------------------------------------------------------
-- DBCheckIndex
-----------------------------------------------------------------
on tDBCheckIndex
tTest "DBCheckIndex"
if the machineType <> 256 then
put the moviePath & "Test Data:VIDNAME" into theDBFile
else
put the moviePath & "TESTDATA\VIDNAME" into theDBFile
end if
put DBUseIndex(theDBFile) into indexID
if indexID < 0 then
tFail
else
put DBCheckIndex(indexID) into DBResult
if DBResult < 0 then
tmsg "==== Check index result code: " & DBResult
tFail
else
put DBCloseIndex(indexID) into DBResult
if DBResult < 0 then
tmsg "==== Close index result code: " & DBResult
tFail
else
tPass
end if
end if
end if
end tDBCheckIndex
-----------------------------------------------------------------
-- DBReindex
-----------------------------------------------------------------
on tDBReindex
tTest "DBReindex"
if the machineType <> 256 then
put the moviePath & "Test Data:VIDNAME" into theDBFile
else
put the moviePath & "TESTDATA\VIDNAME" into theDBFile
end if
put DBUseIndex(theDBFile) into indexID
if indexID < 0 then
tFail
else
put DBReindex(indexID) into DBResult
if DBResult < 0 then
tFail
else
put DBCloseIndex(indexID) into DBResult
if DBResult < 0 then
tFail
else
tPass
end if
end if
end if
end tDBReindex