home *** CD-ROM | disk | FTP | other *** search
/ PowerPlay 1997 March / PowerPlay0397.iso / T-ONLINE / SHOW / XTRAS / FFXTRAS / -FFVERIF.DIR / 00002_Script_performTests < prev    next >
Text File  |  1996-03-15  |  26KB  |  879 lines

  1.  
  2. on startMovie
  3.   global dgBlueColor, dgYellowColor
  4.   global dgMonospace, dgMonosize
  5.   put empty into field "mmsg"
  6.   put empty into field "iteration"
  7.   set the text of cast "testName" to EMPTY
  8.   if the machineType = 256 then
  9.     put "Courier New" into dgMonospace
  10.     put 10 into dgMonosize
  11.   else
  12.     put "Monaco" into dgMonospace
  13.     put 9 into dgMonosize
  14.   end if
  15.   put the foreColor of member "blueModel" into dgBlueColor
  16.   put the foreColor of member "yellowModel" into dgYellowColor
  17.   put the foreColor of member "dkBlueModel" into dgDkBlueColor
  18.   set the textHeight of member "mmsg" to 11
  19.   set the textFont of member "mmsg" to dgMonospace
  20.   set the textSize of member "mmsg" to dgMonosize
  21.   set the foreColor of member "mmsg" to dgYellowColor
  22.   set the textFont of member "testName" to "Helvetica"
  23.   set the textSize of member "testName" to 9
  24.   set the foreColor of member "testName" to dgYellowColor
  25.   put "0" into field "iteration"
  26.   set the textFont of member "iteration" to "Helvetica"
  27.   set the textSize of member "iteration" to 9
  28.   set the foreColor of member "iteration" to dgBlueColor
  29. end startMovie
  30.  
  31. on closeWindow
  32.   put the windowList into theList
  33.   repeat with i = 1 to count(theList)
  34.     put string(getAt(theList,i)) into theItem
  35.     delete word 1 of theItem
  36.     delete char 1 of theItem
  37.     put the number of chars of theItem into theChar
  38.     delete char theChar-1 to theChar of theItem
  39.     if (theItem contains "Validation Suite") or (theItem contains "FFVERIF") then
  40.       forget window theItem
  41.     end if
  42.   end repeat
  43.   tell the stage to puppetPalette 0
  44.   tell the stage to updateStage
  45. end closeWindow
  46.  
  47. on performTests
  48.   -----------------------------------------------------------------
  49.   -- Initializing the test
  50.   -----------------------------------------------------------------
  51.   global gDBActive1030
  52.   global dgBlueColor, dgYellowColor
  53.   global dgMonospace, dgMonosize
  54.   if gDBActive1030 = "true" then 
  55.     put DBCloseSession() into DBResult
  56.     if DBResult < 0 then
  57.       tmsg "==== Session was active.  DBCloseSession reset failed."
  58.       tFail
  59.     end if
  60.   end if
  61.   -----------------------------------------------------------------
  62.   put dgBlueColor into blueHold
  63.   put dgYellowColor into yellowHold
  64.   put dgMonospace into monoHold
  65.   put dgMonosize into monoSize
  66.   clearGlobals
  67.   global dgBlueColor
  68.   global dgYellowColor
  69.   global dgMonospace, dgMonosize
  70.   put blueHold into dgBlueColor
  71.   put yellowHold into dgYellowColor
  72.   put monoHold into dgMonospace
  73.   put monoSize into dgMonosize
  74.   global verboseTest
  75.   put false into verboseTest
  76.   -----------------------------------------------------------------
  77.   put empty into field "iteration"
  78.   put empty into field "mmsg"
  79.   put DBVersion() & return into field "mmsg"
  80.   set the textFont of member "mmsg" to dgMonospace
  81.   set the textSize of member "mmsg" to dgMonosize
  82.   set the textHeight of member "mmsg" to 11
  83.   set the foreColor of member "mmsg" to dgYellowColor
  84.   put the freebytes into origMasterBytes
  85.   put the freeBlock into origMasterBlock  
  86.   
  87.   -----------------------------------------------------------------
  88.   -- Begin the tests
  89.   -----------------------------------------------------------------
  90.   tXtraTest
  91.   set the textFont of member "testName" to "Helvetica"
  92.   set the textSize of member "testName" to 9
  93.   set the foreColor of member "testName" to dgBlueColor
  94.   set the textFont of member "iteration" to "Helvetica"
  95.   set the textSize of member "iteration" to 9
  96.   set the foreColor of member "iteration" to dgBlueColor
  97.   tGlobalVariables
  98.   tDBOpenSession
  99.   tDBCloseSession
  100.   tDBOpenSessionStressTest
  101.   
  102.   tDBOpenSession  -- for the rest of the tests
  103.   tDBUse "VIDEO.DBF"
  104.   tDBClose "1"
  105.   tDBDatabaseExists "VIDEO.DBF"
  106.   tDBUse "VIDEO.DBF"
  107.   tDBCloseAll
  108.   --
  109.   -- Using VIDEO DBF
  110.   tDBUse "VIDEO.DBF"
  111.   tDBListFields
  112.   tDBCount
  113.   tDBBottom
  114.   tDBCurrRecNum 31
  115.   tDBTop
  116.   tDBCurrRecNum 1
  117.   tDBGo
  118.   tDBCurrRecNum 18
  119.   
  120.   tRetrieveChar
  121.   tRetrieveNum
  122.   tRetrieveLogical
  123.   tRetrieveDate
  124.   tRetrieveMemo
  125.   tDBGetCurrRecValG
  126.   tDBSum 
  127.   tDBCloseAll
  128.   
  129.   tDBUse "VIDEO.DBF"
  130.   tDBLocate
  131.   tDBClose "1"
  132.   
  133.   tDBUse "VIDEO.DBF"
  134.   tDBCreateIndex  
  135.   tDBCheckIndex 
  136.   tDBReindex
  137.   tDBSeek
  138.   tDBClose "1"
  139.   
  140.   -- 
  141.   -- using DATA01
  142.   tDBCreate
  143.   tDBWriteRecG
  144.   tDBFindMemo
  145.   tDBZapRecs
  146.   tDBWriteRecX
  147.   tDBZapRecs
  148.   tDBCloseAll
  149.   
  150.   tDBEncrypt
  151.   
  152.   tDBCreateMany
  153.   tDBCloseAll
  154.   tDBWriteRecManyX
  155.   
  156.   tDBCloseSession
  157.   
  158.   -----------------------------------------------------------------
  159.   put "" into field "iteration"
  160.   put the freeBytes into newBytes
  161.   put origMasterBytes - newBytes into theBytes
  162.   tmsg "== End of test sequence:"
  163.   tmsg "==== Overall test consumed" && theBytes && "bytes."
  164.   tmsg "==== The largest contiguous free block at start"
  165.   tmsg "==== was" && origMasterBlock && "bytes."
  166.   tmsg ""
  167.   tmsg "==== The largest contiguous remaining free block"
  168.   tmsg "==== is" && the freeBlock && "bytes."
  169.   tmsg ""
  170.   tmsg ""
  171.   put empty into field "iteration"
  172.   set the text of cast "testName" to EMPTY
  173.   beep
  174. end performTests
  175.  
  176.  
  177. ----------------------------------------------------------------------------------------------------------------------------------
  178. ------------------------  TEST ROUTINE SEGMENT --------------------------------------------------------------------
  179. ----------------------------------------------------------------------------------------------------------------------------------
  180.  
  181. -----------------------------------------------------------------
  182. -- Calling the Xtra test
  183. -----------------------------------------------------------------
  184. on tXtraTest
  185.   global dgBlueColor
  186.   put empty into field "iteration"
  187.   put field "iterations" into max
  188.   tTest "Loading of Xtra"
  189.   repeat with i = 1 to max
  190.     put DBVersion() into dummy
  191.     put i into field "iteration"
  192.     set the textFont of member "iteration" to "Helvetica"
  193.     set the textSize of member "iteration" to 9
  194.     set the foreColor of member "iteration" to dgBlueColor
  195.   end repeat
  196.   tPass
  197. end tXtraTest
  198.  
  199. -----------------------------------------------------------------
  200. -- Code to test interface to global variables
  201. -----------------------------------------------------------------
  202. on tGlobalVariables
  203.   global dgBlueColor
  204.   put field "iterations" into max
  205.   put "" into field "iteration"
  206.   tTest "Global Variable Interface"
  207.   global testGlobal1, testGlobal2
  208.   global theLong, theDouble
  209.   put false into testFail
  210.   repeat with i = 1 to max
  211.     put DBSetGlobal("testGlobal1","TestData") into dummy
  212.     put DBSetGlobal("testGlobal2","Test2Data") into dummy
  213.     -- this tests to make sure we can read a global that's not most recent
  214.     put DBGetGlobal("testGlobal1") into theGlob1
  215.     if theGlob1 <> "TestData" then
  216.       tmsg return & "==== testGlobal1 returned" && theGlob1
  217.       put true into testFail
  218.       exit repeat
  219.     end if
  220.     put DBGetGlobal("testGlobal2") into theGlob2
  221.     if theGlob2 <> "Test2Data" then
  222.       tmsg return & "==== testGlobal2 returned" && theGlob2
  223.       put true into testFail
  224.       exit repeat
  225.     end if
  226.     put 896 into theLong
  227.     put 493.22 into theDouble
  228.     put dbGetGlobal("theLong") into theLongResult
  229.     if theLongResult <> 896 then
  230.       put true into testFail
  231.       exit repeat
  232.     end if
  233.     put dbGetGlobal("theDouble") into theDoubleResult
  234.     if string(theDoubleResult) <> "493.22" then
  235.       put true into testFail
  236.       exit repeat
  237.     end if
  238.     put i into field "iteration"
  239.     set the textFont of member "iteration" to "Helvetica"
  240.     set the textSize of member "iteration" to 9
  241.     set the foreColor of member "iteration" to dgBlueColor
  242.   end repeat
  243.   if testFail = true then
  244.     tFail
  245.     exit
  246.   else
  247.     tPass
  248.   end if
  249. end tGlobalVariables
  250.  
  251. -----------------------------------------------------------------
  252. -- DBOpenSession
  253. -----------------------------------------------------------------
  254. on tDBOpenSession
  255.   tTest "DBOpenSession"
  256.   put DBOpenSession() into DBResult
  257.   if DBResult = 0 then
  258.     tPass
  259.   else
  260.     tmsg "== DBOpenSession returned" && DBResult & "."
  261.     tFail
  262.     exit
  263.   end if
  264. end tDBOpenSession
  265.  
  266. -----------------------------------------------------------------
  267. -- DBCloseSession
  268. -----------------------------------------------------------------
  269. on tDBCloseSession
  270.   tTest "DBCloseSession"
  271.   put DBCloseSession() into DBResult
  272.   if DBResult = 0 then
  273.     tPass
  274.   else
  275.     tmsg "== DBCloseSession returned" && DBResult & "."
  276.     tFail
  277.     exit
  278.   end if
  279. end tDBCloseSession
  280.  
  281. -----------------------------------------------------------------
  282. -- DBOpenSession stress test
  283. -----------------------------------------------------------------
  284. on tDBOpenSessionStressTest
  285.   global dgBlueColor
  286.   tTest "DBOpenSession/DBCloseSession Stress"
  287.   put field "iterations" into max
  288.   put "" into field "iteration"
  289.   repeat with i = 1 to max
  290.     put i into field "iteration"
  291.     set the textFont of member "iteration" to "Helvetica"
  292.     set the textSize of member "iteration" to 9
  293.     set the foreColor of member "iteration" to dgBlueColor
  294.     put DBOpenSession() into DBResult
  295.     if DBResult < 0 then
  296.       tmsg "==== DBOpenSession returned" && DBResult & ".  (failed)"
  297.       tFail
  298.       exit
  299.     end if
  300.     put DBCloseSession() into DBResult
  301.     if DBResult < 0 then
  302.       tmsg "==== DBCloseSession returned" && DBResult & ".  (failed)"
  303.       tFail
  304.       exit
  305.     end if
  306.   end repeat
  307.   tPass
  308. end tDBOpenSessionStressTest
  309.  
  310. -----------------------------------------------------------------
  311. -- DBUse test
  312. -----------------------------------------------------------------
  313. on tDBUse theFile
  314.   -- expects original VIDEO.DBF/VIDEO.DBT
  315.   tTest "DBUse"
  316.   if the machineType <> 256 then
  317.     put the moviePath & "Test Data:" & theFile into theDBFile
  318.   else
  319.     put the moviePath & "TESTDATA\" &  theFile into theDBFile
  320.   end if
  321.   put DBUse(theDBFile) into videoID
  322.   if videoID < 0 then
  323.     tmsg "==== DBUse returned" && videoID & ".  (failed)"
  324.     tFail
  325.     exit
  326.   else
  327.     tPass
  328.   end if
  329. end tDBUse
  330.  
  331. -----------------------------------------------------------------
  332. -- DBClose test
  333. -----------------------------------------------------------------
  334. on tDBClose videoID
  335.   -- expects previous DBUse to have passed
  336.   tTest "DBClose"
  337.   put DBClose(videoID) into DBResult
  338.   if videoID < 0 then
  339.     tmsg "==== DBClose returned" && videoID & ".  (failed)"
  340.     tFail
  341.     exit
  342.   else
  343.     tPass
  344.   end if
  345. end tDBClose
  346.  
  347. -----------------------------------------------------------------
  348. -- DBDatabaseExists test
  349. -----------------------------------------------------------------
  350. on tDBDatabaseExists theFile
  351.   tTest "DBDatabaseExists"
  352.   if the machineType <> 256 then
  353.     put the moviePath & "Test Data:" & theFile into theDBFile
  354.   else
  355.     put the moviePath & "TESTDATA\" &  theFile into theDBFile
  356.   end if
  357.   put DBDatabaseExists(theDBFile) into theID
  358.   if theID < 0 then
  359.     tmsg "==== DBDatabaseExists returned" && theID & ".  (failed)"
  360.     tFail
  361.     exit
  362.   end if
  363.   put DBDatabaseExists("nosuchfile") into theID
  364.   if theID >= 0 then
  365.     tmsg "==== DBDatabaseExists returned" && theID & ".  (failed)"
  366.     tFail
  367.     exit
  368.   end if
  369.   tPass
  370. end tDBDatabaseExists
  371.  
  372. -----------------------------------------------------------------
  373. -- DBCloseAll test
  374. -----------------------------------------------------------------
  375. on tDBCloseAll
  376.   -- expects previous DBUse to have passed
  377.   tTest "DBCloseAll on one open database"
  378.   put DBCloseAll() into DBResult
  379.   if DBResult < 0 then
  380.     tmsg "==== DBCloseAll returned" && DBResult & ".  (failed)"
  381.     tFail
  382.     exit
  383.   else
  384.     tPass
  385.   end if
  386. end tDBCloseAll
  387.  
  388. -----------------------------------------------------------------
  389. -- DBListFields test
  390. -----------------------------------------------------------------
  391. on tDBListFields
  392.   -- expects original VIDEO.DBF/VIDEO.DBT and 
  393.   -- an unmucked-with cast member videoDBFschema
  394.   tTest "DBListFields (for one file)"
  395.   put DBListFields() into theFields
  396.   if theFields <> field "videoDBFschema" then
  397.     tFail
  398.     exit
  399.   else
  400.     tPass
  401.   end if
  402. end tDBListFields
  403.  
  404. -----------------------------------------------------------------
  405. -- DBCount test
  406. -----------------------------------------------------------------
  407. on tDBCount
  408.   -- expects original VIDEO.DBF/VIDEO.DBT 
  409.   tTest "DBCount"
  410.   put DBCount() into theCount
  411.   if theCount <> 31 then
  412.     tFail
  413.     exit
  414.   else
  415.     tPass
  416.   end if
  417. end tDBCount
  418.  
  419. -----------------------------------------------------------------
  420. -- DBBottom test
  421. -----------------------------------------------------------------
  422. on tDBBottom
  423.   -- expects original VIDEO.DBF/VIDEO.DBT 
  424.   tTest "DBBottom"
  425.   put DBBottom() into theResult
  426.   if theResult < 0 then
  427.     tmsg "==== DBBottom returned" && theResult & ".  (failed)"
  428.     tFail
  429.     exit
  430.   else
  431.     tPass
  432.   end if
  433. end tDBBottom
  434.  
  435. -----------------------------------------------------------------
  436. -- DBCurrRecNum test
  437. -----------------------------------------------------------------
  438. on tDBCurrRecNum theNum
  439.   -- expects original VIDEO.DBF/VIDEO.DBT 
  440.   tTest "DBCurrRecNum"
  441.   put DBCurrRecNum() into theResult
  442.   if theResult <> theNum then
  443.     tFail
  444.     exit
  445.   else
  446.     tPass
  447.   end if
  448. end  
  449.  
  450. -----------------------------------------------------------------
  451. -- DBTop test
  452. -----------------------------------------------------------------
  453. on tDBTop
  454.   -- expects original VIDEO.DBF/VIDEO.DBT 
  455.   tTest "DBTop"
  456.   put DBTop() into theResult
  457.   if theResult < 0 then
  458.     tmsg "==== DBTop returned" && theResult & ".  (failed)"
  459.     tFail
  460.     exit
  461.   else
  462.     tPass
  463.   end if
  464. end tDBTop
  465.  
  466. -----------------------------------------------------------------
  467. -- DBLocate test
  468. -----------------------------------------------------------------
  469. on tDBLocate
  470.   -- expects original VIDEO.DBF/VIDEO.DBT 
  471.   tTest "DBLocate"
  472.   put DBTop() into theResult
  473.   put DBLocate("TITLE = 'GHOSTBUSTERS'") into DBResult
  474.   if DBResult <> 0 then
  475.     tFail
  476.   else
  477.     if DBCurrRecNum() <> 21 then
  478.       tFail
  479.     else
  480.       tPass
  481.     end if
  482.   end if
  483.   put DBTop() into dummy
  484. end tDBLocate
  485.  
  486. -----------------------------------------------------------------
  487. -- DBGo test
  488. -----------------------------------------------------------------
  489. on tDBGo
  490.   -- expects original VIDEO.DBF/VIDEO.DBT 
  491.   tTest "DBGo"
  492.   put DBGo(18) into theResult
  493.   if theResult < 0 then
  494.     tmsg "==== DBGo returned" && theResult & ".  (failed)"
  495.     tFail
  496.     exit
  497.   else
  498.     tPass
  499.   end if
  500. end tDBGo
  501.  
  502. -----------------------------------------------------------------
  503. -- Retrieve character field test
  504. -----------------------------------------------------------------
  505. on tRetrieveChar
  506.   tTest "Retrieve Character (C) field"
  507.   put DBGetFieldByName("TITLE") into theResult
  508.   if theResult <> "A NIGHTMARE ON ELM STREET" then
  509.     tFail
  510.     exit
  511.   else
  512.     tPass
  513.   end if
  514. end tRetrieveChar
  515.  
  516. -----------------------------------------------------------------
  517. -- Retrieve numeric field test
  518. -----------------------------------------------------------------
  519. on tRetrieveNum
  520.   tTest "Retrieve Numeric (N) field"
  521.   put DBGetFieldByName("COST_BUY") into theResult
  522.   if theResult <>29.95 then
  523.     tFail
  524.     exit
  525.   else
  526.     tPass
  527.   end if
  528. end tRetrieveNum
  529.  
  530. -----------------------------------------------------------------
  531. -- Retrieve logical field test
  532. -----------------------------------------------------------------
  533. on tRetrieveLogical
  534.   tTest "Retrieve Logical (L) field"
  535.   put DBGetFieldByName("AVAILABLE") into theResult
  536.   if theResult <> "F" then
  537.     tFail
  538.     exit
  539.   else
  540.     tPass
  541.   end if
  542. end tRetrieveLogical
  543.  
  544. -----------------------------------------------------------------
  545. -- Retrieve date field test
  546. -----------------------------------------------------------------
  547. on tRetrieveDate
  548.   tTest "Retrieve Date (D) field"
  549.   put DBGetFieldByName("DATE_ARRIV") into theResult
  550.   if theResult <> "19860314" then
  551.     tFail
  552.     exit
  553.   else
  554.     tPass
  555.   end if
  556. end tRetrieveDate
  557.  
  558. -----------------------------------------------------------------
  559. -- Retrieve memo field test
  560. -----------------------------------------------------------------
  561. on tRetrieveMemo
  562.   tTest "DBGetMemo"
  563.   put DBGetMemo("DESCRIPT") into theResult
  564.   if theResult <> the text of cast "testMemoData" then
  565.     tFail
  566.     exit
  567.   else
  568.     tPass
  569.   end if
  570. end tRetrieveMemo
  571.  
  572. -----------------------------------------------------------------
  573. -- DBSum test
  574. -----------------------------------------------------------------
  575. on tDBSum
  576.   tTest "DBSum"
  577.   put the floatPrecision into fp
  578.   set the floatPrecision to 2
  579.   put DBSum("COST_RENT") into theResult
  580.   if theResult <> 98.95  then
  581.     tFail
  582.   else
  583.     put DBSum("COST_BUY") into theResult
  584.     if theResult <> 984.52  then
  585.       tFail
  586.     else
  587.       tPass
  588.     end if
  589.   end if
  590.   set the floatPrecision to fp
  591. end tDBSum
  592.  
  593. -----------------------------------------------------------------
  594. -- DBGetCurrRecVal("G") test
  595. -----------------------------------------------------------------
  596. on tDBGetCurrRecValG
  597.   tTest "DBGetCurrRecVal(G)"
  598.   put DBGetCurrRecVal("G") into theResult
  599.   global TITLE, COST_BUY, AVAILABLE, DATE_ARRIV, DESCRIPT
  600.   if TITLE <> "A NIGHTMARE ON ELM STREET" then
  601.     tmsg "==== DBGetCurrRecVal(G) character data mismatch.  (failed)"
  602.     tFail
  603.     exit
  604.   end if
  605.   if COST_BUY <> 29.95 then
  606.     tmsg "==== DBGetCurrRecVal(G) numeric data mismatch.  (failed)"
  607.     tFail
  608.     exit
  609.   end if
  610.   if AVAILABLE <> "F" then
  611.     tmsg "==== DBGetCurrRecVal(G) logical data mismatch.  (failed)"
  612.     tFail
  613.     exit
  614.   end if
  615.   if DATE_ARRIV <> "19860314" then
  616.     tmsg "==== DBGetCurrRecVal(G) date data mismatch.  (failed)"
  617.     tFail
  618.     exit
  619.   end if
  620.   if DESCRIPT <> the text of cast "testMemoData" then
  621.     tmsg "==== DBGetCurrRecVal(G) memo data mismatch.  (failed)"
  622.     tFail
  623.     exit
  624.   end if
  625.   tPass
  626. end tDBGetCurrRecValG
  627.  
  628. -----------------------------------------------------------------
  629. -- DBCreate test
  630. -----------------------------------------------------------------
  631. on tDBCreate
  632.   tTest "DBCreate"
  633.   put "CHAR_FLD,C,25" into schema
  634.   put return & "NUM_FLD,N,8,3" after schema
  635.   put return & "MEMO_FLD,M" after schema
  636.   put the moviePath & "TEST01"  into theDBFile
  637.   if the machineType <> 256 then
  638.     put the moviePath & "Test Data:TEST01"  into theDBFile
  639.   else
  640.     put the moviePath & "TESTDATA\TEST01"  into theDBFile
  641.   end if
  642.   put DBCreate(theDBFile,3,schema,"false") into dbResult
  643.   if dbResult < 0 then
  644.     tmsg "==== dbResult returned" && dbResult & ".  (failed)"
  645.     tFail
  646.     exit
  647.   end if
  648.   put DBCloseAll() into DBResult
  649.   if DBResult < 0 then
  650.     tmsg "==== DBCloseAll returned" && DBResult & ".  (failed)"
  651.     tFail
  652.     exit
  653.   end if
  654.   put DBUse(theDBFile) into videoID
  655.   if videoID < 0 then
  656.     tmsg "==== DBUse returned" && videoID & ".  (failed)"
  657.     tFail
  658.     exit
  659.   end if
  660.   put DBListFields() into theFields
  661.   put "3" & return & "CHAR_FLD,C,25,0" into fieldCheck
  662.   put return & "NUM_FLD,N,8,3" after fieldCheck
  663.   put return & "MEMO_FLD,M,10,0" & return after fieldCheck
  664.   if theFields <> fieldCheck then
  665.     tmsg "==== DBCreate's fields don't match .  (failed)"
  666.     tFail
  667.     exit
  668.   end if
  669.   tPass
  670. end tDBCreate
  671.  
  672. -----------------------------------------------------------------
  673. -- DBWriteRec(G)
  674. -----------------------------------------------------------------
  675. on tDBWriteRecG
  676.   global dgBlueColor
  677.   put field "iterations" into max
  678.   put "" into field "iteration"
  679.   tTest "DBWriteRec(G)"
  680.   global CHAR_FLD, NUM_FLD, MEMO_FLD
  681.   repeat with i = 1 to max
  682.     set the textFont of member "iteration" to "Helvetica"
  683.     set the textSize of member "iteration" to 9
  684.     set the foreColor of member "iteration" to dgBlueColor
  685.     put i into field "iteration"
  686.     put string(integer(i)) into NUM_FLD
  687.     put "Loop [" & integer(i) & "]" into CHAR_FLD
  688.     put "[" & integer(i) & "]" && the text of cast "testMemoData"  into MEMO_FLD
  689.     put DBCurrRecNum() + 1 into theRec
  690.     put DBWriteRec("G", theRec) into DBResult
  691.     if DBResult < 0 then
  692.       tmsg "==== DBWriteRec(G) returned" && DBResult & ".  (failed)"
  693.       tFail
  694.       exit
  695.     end if
  696.   end repeat
  697.   put DBCount() into numRecs
  698.   if numRecs <> max then
  699.     tmsg "==== DBWriteRec(G) had wrong total record count.  (failed)"
  700.     tFail
  701.     exit
  702.   end if
  703.   repeat with i = max down to 1
  704.     put integer(i) into field "iteration"
  705.     put DBGo(i) into DBResult
  706.     if DBResult < 0 then
  707.       tmsg "==== DBGo returned" && DBResult & ".  (failed)"
  708.       tFail
  709.       exit
  710.     end if
  711.     put "" into CHAR_FLD
  712.     put "" into NUM_FLD
  713.     put "" into MEMO_FLD
  714.     put DBGetCurrRecVal("G") into DBResult
  715.     put i into NUM_FLDx
  716.     put "Loop [" &integer(i) & "]" into CHAR_FLDx
  717.     put "[" &integer(i) & "]" && the text of cast "testMemoData"  into MEMO_FLDx
  718.     if NUM_FLDx <> NUM_FLD then
  719.       tmsg ""
  720.       tmsg "==== Numeric data retrieval mismatch.  (failed)"
  721.       tmsg "==== NUM_FLD is [" & NUM_FLD & "]."
  722.       tmsg "==== NUM_FLD should be [" & NUM_FLDx & "]."
  723.       tFail
  724.       exit
  725.     end if
  726.     if CHAR_FLDx <> CHAR_FLD then
  727.       tmsg "==== Character data retrieval mismatch.  (failed)"
  728.       tmsg "==== CHAR_FLD is [" & CHAR_FLD & "]."
  729.       tmsg "==== CHAR_FLD should be [" & CHAR_FLDx & "]."
  730.       tFail
  731.       exit
  732.     end if
  733.     if MEMO_FLDx <> MEMO_FLD then
  734.       tmsg "==== Memo data retrieval mismatch.  (failed)"
  735.       tFail
  736.       exit
  737.     end if
  738.   end repeat
  739.   tPass
  740. end tDBWriteRecG
  741.  
  742. -----------------------------------------------------------------
  743. -- DBFindMemo
  744. -----------------------------------------------------------------
  745. on tDBFindMemo
  746.   put field "iterations" into max
  747.   if max > 20 then
  748.     tTest "DBFindMemo"
  749.     put DBTop() into DBResult
  750.     put "[18] Starring" into searchStr
  751.     put DBFindMemo("MEMO_FLD", searchStr) into DBResult
  752.     if DBResult < 0 then
  753.       tFail
  754.     else
  755.       if DBCurrRecNum() <> 18 then
  756.         tFail
  757.       else
  758.         tPass
  759.       end if
  760.     end if
  761.   end if
  762. end tDBFindMemo
  763.  
  764. -----------------------------------------------------------------
  765. -- DBZapRecs
  766. -----------------------------------------------------------------
  767. on tDBZapRecs
  768.   put "" into field "iteration"
  769.   tTest "DBZapRecs"
  770.   put DBCount() into theCount
  771.   if theCount <> field "iterations" then
  772.     tmsg "==== Incorrect record count.  (failed)"
  773.     tFail
  774.     exit
  775.   end if
  776.   put DBZapRecs(1,theCount) into DBResult
  777.   if DBResult < 0 then
  778.     tFail
  779.     exit
  780.   end if
  781.   tPass
  782. end tDBZapRecs
  783.  
  784. -----------------------------------------------------------------
  785. -- DBEncrypt
  786. -----------------------------------------------------------------
  787. on tDBEncrypt
  788.   tTest "DBEncrypt/DBDecrypt"
  789.   put "This is a test" into theS
  790.   put DBEncrypt(theS,"mykey") into theEncryptS
  791.   put DBDecrypt(theEncryptS,"mykey") into theS2
  792.   if theS <> theS2 then
  793.     tFail
  794.   else
  795.     tPass
  796.   end if
  797. end tDBEncrypt
  798.  
  799. -----------------------------------------------------------------
  800. -- DBCreateIndex
  801. -----------------------------------------------------------------
  802. on tDBCreateIndex
  803.   tTest "DBCreateIndex"
  804.   if the machineType <> 256 then
  805.     put the moviePath & "Test Data:VIDNAME"  into theDBFile
  806.   else
  807.     put the moviePath & "TESTDATA\VIDNAME"  into theDBFile
  808.   end if
  809.   put DBCreateIndex(theDBFile,"UPPER(TITLE)","0","0") into indexID
  810.   if indexID < 0 then
  811.     tFail
  812.   else
  813.     put DBCloseIndex(indexID) into DBResult
  814.     if DBResult < 0 then
  815.       tFail
  816.     else
  817.       tPass
  818.     end if
  819.   end if
  820. end tDBCreateIndex
  821.  
  822. -----------------------------------------------------------------
  823. -- DBCheckIndex
  824. -----------------------------------------------------------------
  825. on tDBCheckIndex
  826.   tTest "DBCheckIndex"
  827.   if the machineType <> 256 then
  828.     put the moviePath & "Test Data:VIDNAME"  into theDBFile
  829.   else
  830.     put the moviePath & "TESTDATA\VIDNAME"  into theDBFile
  831.   end if
  832.   put DBUseIndex(theDBFile) into indexID
  833.   if indexID < 0 then
  834.     tFail
  835.   else
  836.     put DBCheckIndex(indexID) into DBResult
  837.     if DBResult < 0 then
  838.       tmsg "==== Check index result code: " & DBResult
  839.       tFail
  840.     else
  841.       put DBCloseIndex(indexID) into DBResult
  842.       if DBResult < 0 then
  843.         tmsg "==== Close index result code: " & DBResult
  844.         tFail
  845.       else
  846.         tPass
  847.       end if
  848.     end if
  849.   end if
  850. end tDBCheckIndex
  851.  
  852. -----------------------------------------------------------------
  853. -- DBReindex
  854. -----------------------------------------------------------------
  855. on tDBReindex
  856.   tTest "DBReindex"
  857.   if the machineType <> 256 then
  858.     put the moviePath & "Test Data:VIDNAME"  into theDBFile
  859.   else
  860.     put the moviePath & "TESTDATA\VIDNAME"  into theDBFile
  861.   end if
  862.   put DBUseIndex(theDBFile) into indexID
  863.   if indexID < 0 then
  864.     tFail
  865.   else
  866.     put DBReindex(indexID) into DBResult
  867.     if DBResult < 0 then
  868.       tFail
  869.     else
  870.       put DBCloseIndex(indexID) into DBResult
  871.       if DBResult < 0 then
  872.         tFail
  873.       else
  874.         tPass
  875.       end if
  876.     end if
  877.   end if
  878. end tDBReindex
  879.