Annotation of mstools/mstest/include/ftestutl.mst, revision 1.1

1.1     ! root        1: 'FTESTUtl.inc - definitions for Fast Test Utility routines
        !             2: '
        !             3: '  Copyright (c) 1991-1992, Microsoft Corporation. All rights reserved.
        !             4: '
        !             5: 'Purpose:
        !             6: ' This file defines the utility functions of the Fast Test functionality
        !             7: '
        !             8: 'NOTES:
        !             9: ' See FASTTEST.INC for description of the Error catching that is coded
        !            10: ' throughout this module.
        !            11: 
        !            12: 
        !            13: '**********************************************************
        !            14: '***************** File Subroutines ***********************
        !            15: '**********************************************************
        !            16: 
        !            17: 
        !            18: '
        !            19: ' XFileExists(stFileSpec$)
        !            20: '
        !            21: ' Description:
        !            22: '       Checks that stFileSpec$  exists.
        !            23: '       logs a failure if it can't find it (them; accept wildcards)
        !            24: '
        !            25: ' Parameters:
        !            26: '       stFileSpec$  - file specification
        !            27: '
        !            28: ' Returns:
        !            29: '       nothing
        !            30: '
        !            31: ' Example:
        !            32: '       XFileExists "*.bak"
        !            33: '
        !            34: '
        !            35: SUB XFileExists(stFileSpec$) STATIC
        !            36:     IF NOT EXISTS(stFileSpec$) THEN
        !            37:         XLogFailure stFileSpec$ + " doesn't exist"
        !            38:     END IF
        !            39: END SUB
        !            40: 
        !            41: '
        !            42: ' XFileNotExists(stFileSpec$)
        !            43: '
        !            44: ' Description:
        !            45: '       Checks that stFileSpec$ doesn't exist.
        !            46: '       logs a failure if it finds it (them; accepts wildcards)
        !            47: '
        !            48: ' Parameters:
        !            49: '       stFileSpec$  - file specification
        !            50: '
        !            51: ' Returns:
        !            52: '       nothing
        !            53: '
        !            54: ' Example:
        !            55: '       XFileNotExists "*.bak"
        !            56: '
        !            57: '
        !            58: SUB XFileNotExists(stFileSpec$) STATIC
        !            59:     IF EXISTS(stFileSpec$) THEN
        !            60:         XLogFailure stFileSpec$ + " exists"
        !            61:     END IF
        !            62: END SUB
        !            63: 
        !            64: '
        !            65: ' BFileExists(stFileSpec$)
        !            66: '
        !            67: ' Description:
        !            68: '       Checks if stFileSpec$ exists
        !            69: '
        !            70: ' Parameters:
        !            71: '       stFileSpec$  - file specification
        !            72: '
        !            73: ' Returns:
        !            74: '       TRUE if it exists, FALSE if not
        !            75: '
        !            76: '
        !            77: '
        !            78: FUNCTION BFileExists%(stFileSpec$) STATIC
        !            79:     BFileExists = EXISTS(stFileSpec$)
        !            80: END FUNCTION
        !            81: 
        !            82: 
        !            83: '
        !            84: ' XFileCmp(stFileSpec1$,stFileSpec2$)
        !            85: '
        !            86: ' Description:
        !            87: '       Compares two files, line by line
        !            88: '       Logs a Failure if the files don't exist or are different
        !            89: '
        !            90: ' Parameters:
        !            91: '       stFileSpec1$,stFileSpec2  - file specifications
        !            92: '
        !            93: ' Returns:
        !            94: '       nothing
        !            95: '
        !            96: ' Example:
        !            97: '       XFileCmp "Foo.dat","foo.bsl"
        !            98: '
        !            99: '
        !           100: '
        !           101: SUB XFileCmp(stFileSpec1$,stFileSpec2$) STATIC
        !           102:     DIM fh1%    ' file handle of first file
        !           103:     DIM fh2%    ' file handle of second file
        !           104:     DIM line1$  ' line from first file
        !           105:     DIM line2$  ' line from second file
        !           106:     DIM done    ' flag to stop looping
        !           107:     DIM diff    ' flag to indicate if files compare
        !           108: 
        !           109:     gErrorType = ET_NEXT
        !           110:     fh1% = FREEFILE
        !           111:     OPEN stFileSpec1$ FOR INPUT AS #fh1%
        !           112:     fh2% = FREEFILE
        !           113:     OPEN stFileSpec2$ FOR INPUT AS #fh2%
        !           114: 
        !           115:     IF gfError THEN
        !           116:         XLogFailure "Could not open files for XFileCmp"
        !           117:         gErrorType = ET_NOTHING
        !           118:         gfError = FALSE
        !           119:         EXIT SUB
        !           120:     END IF
        !           121: 
        !           122: 
        !           123:     done = FALSE
        !           124:     diff = FALSE
        !           125: 
        !           126:     IF EOF(fh1%) AND EOF(fh2%) THEN
        !           127:         done = TRUE
        !           128: 
        !           129:     ELSEIF EOF(fh1%) OR EOF(fh2%) THEN
        !           130:         diff = TRUE
        !           131:         done = TRUE
        !           132:     END IF
        !           133: 
        !           134: 
        !           135:     WHILE NOT done
        !           136: 
        !           137:         LINE INPUT #fh1%,line1$
        !           138:         LINE INPUT #fh2%,line2$
        !           139: 
        !           140:         IF gfError THEN
        !           141:             XLogFailure "XFileCmp INPUT or EOF errors"
        !           142:             gErrorType = ET_NOTHING
        !           143:             gfError = FALSE
        !           144:             EXIT SUB
        !           145:         END IF
        !           146: 
        !           147: 
        !           148:         IF line1$ <> line2$ THEN
        !           149:             done = TRUE
        !           150:             diff = TRUE
        !           151:         END IF
        !           152: 
        !           153:         IF NOT done AND EOF(fh1%) AND EOF(fh2%) THEN
        !           154:             done = TRUE
        !           155:         END IF
        !           156: 
        !           157:         IF NOT done AND (EOF(fh1%) OR EOF(fh2%)) THEN
        !           158:             diff = TRUE
        !           159:             done = TRUE
        !           160:         END IF
        !           161: 
        !           162:     WEND
        !           163: 
        !           164:     CLOSE #fh1%
        !           165:     CLOSE #fh2%
        !           166: 
        !           167:     IF gfError THEN
        !           168:         XLogFailure "XFileCmp CLOSE errors"
        !           169:         gErrorType = ET_NOTHING
        !           170:         gfError = FALSE
        !           171:         EXIT SUB
        !           172:     END IF
        !           173: 
        !           174:     gErrorType = ET_NOTHING
        !           175: 
        !           176:     IF diff THEN
        !           177:         XLogFailure "Files " + stFileSpec1$ + "," + stFileSpec2$ + " don't compare"
        !           178:     END IF
        !           179: 
        !           180: END SUB
        !           181: 
        !           182: '
        !           183: ' XFileNotCmp(stFileSpec1$,stFileSpec2$)
        !           184: '
        !           185: ' Description:
        !           186: '       Compares two files, line by line
        !           187: '       Logs a Failure if the files don't exist or are same
        !           188: '
        !           189: ' Parameters:
        !           190: '       stFileSpec1$,stFileSpec2  - file specifications
        !           191: '
        !           192: ' Returns:
        !           193: '       nothing
        !           194: '
        !           195: ' Example:
        !           196: '       XFileNotCmp "Foo.dat","foo.bsl"
        !           197: '
        !           198: '
        !           199: '
        !           200: SUB XFileNotCmp(stFileSpec1$,stFileSpec2$) STATIC
        !           201:     DIM fh1%    ' file handle of first file
        !           202:     DIM fh2%    ' file handle of second file
        !           203:     DIM line1$  ' line from first file
        !           204:     DIM line2$  ' line from second file
        !           205:     DIM done    ' flag to stop looping
        !           206:     DIM diff    ' flag to indicate if files compare
        !           207: 
        !           208:     gErrorType = ET_NEXT
        !           209: 
        !           210:     fh1% = FREEFILE
        !           211:     OPEN stFileSpec1$ FOR INPUT AS #fh1%
        !           212:     fh2% = FREEFILE
        !           213:     OPEN stFileSpec2$ FOR INPUT AS #fh2%
        !           214: 
        !           215:     IF gfError THEN
        !           216:         XLogFailure "Could not open files for XFileNotCmp"
        !           217:         gErrorType = ET_NOTHING
        !           218:         gfError = FALSE
        !           219:         EXIT SUB
        !           220:     END IF
        !           221: 
        !           222:     done = FALSE
        !           223:     diff = FALSE
        !           224: 
        !           225:     IF EOF(fh1%) AND EOF(fh2%) THEN
        !           226:         done = TRUE
        !           227:     END IF
        !           228: 
        !           229:     IF NOT done AND (EOF(fh1%) OR EOF(fh2%)) THEN
        !           230:         diff = TRUE
        !           231:         done = TRUE
        !           232:     END IF
        !           233: 
        !           234:     WHILE NOT done
        !           235: 
        !           236:         LINE INPUT #fh1%,line1$
        !           237:         LINE INPUT #fh2%,line2$
        !           238: 
        !           239:         IF gfError THEN
        !           240:             XLogFailure "XFileNotCmp INPUT or EOF errors"
        !           241:             gErrorType = ET_NOTHING
        !           242:             gfError = FALSE
        !           243:             EXIT SUB
        !           244:         END IF
        !           245: 
        !           246:         IF line1$ <> line2$ THEN
        !           247:             done = TRUE
        !           248:             diff = TRUE
        !           249:         END IF
        !           250: 
        !           251:         IF NOT done AND EOF(fh1%) AND EOF(fh2%) THEN
        !           252:             done = TRUE
        !           253:         END IF
        !           254: 
        !           255:         IF NOT done AND (EOF(fh1%) OR EOF(fh2%)) THEN
        !           256:             diff = TRUE
        !           257:             done = TRUE
        !           258:         END IF
        !           259: 
        !           260:     WEND
        !           261: 
        !           262:     CLOSE #fh1%
        !           263:     CLOSE #fh2%
        !           264: 
        !           265:     IF gfError THEN
        !           266:         XLogFailure "XFileNotCmp CLOSE errors"
        !           267:         gErrorType = ET_NOTHING
        !           268:         gfError = FALSE
        !           269:         EXIT SUB
        !           270:     END IF
        !           271: 
        !           272:     gErrorType = ET_NOTHING
        !           273: 
        !           274:     IF NOT diff THEN
        !           275:         XLogFailure "Files " + stFileSpec1$ + "," + stFileSpec2$ + " do compare"
        !           276:     END IF
        !           277: END SUB
        !           278: 
        !           279: '
        !           280: ' BFileCmp%(stFileSpec1$,stFileSpec2$)
        !           281: '
        !           282: ' Description:
        !           283: '       Compares two files, line by line
        !           284: '       Logs a Failure if the files don't exist
        !           285: '
        !           286: ' Parameters:
        !           287: '       stFileSpec1$,stFileSpec2  - file specifications
        !           288: '
        !           289: ' Returns:
        !           290: '       FALSE IF XFileCmp would detect an error
        !           291: '
        !           292: ' Example:
        !           293: '       x% = BFileCmp "Foo.dat","foo.bsl"
        !           294: '
        !           295: '
        !           296: '
        !           297: FUNCTION BFileCmp%(stFileSpec1$,stFileSpec2$) STATIC
        !           298:     DIM fh1%
        !           299:     DIM fh2%
        !           300:     DIM line1$
        !           301:     DIM line2$
        !           302:     DIM done
        !           303:     DIM diff
        !           304: 
        !           305:     gErrorType = ET_NEXT
        !           306:     fh1% = FREEFILE
        !           307:     OPEN stFileSpec1$ FOR INPUT AS #fh1%
        !           308:     fh2% = FREEFILE
        !           309:     OPEN stFileSpec2$ FOR INPUT AS #fh2%
        !           310: 
        !           311:     IF gfError THEN
        !           312:         BFileCmp = FALSE
        !           313:         gErrorType = ET_NOTHING
        !           314:         gfError = FALSE
        !           315:         EXIT FUNCTION
        !           316:     END IF
        !           317: 
        !           318:     done = FALSE
        !           319:     diff = FALSE
        !           320: 
        !           321:     IF EOF(fh1%) AND EOF(fh2%) THEN
        !           322:         done = TRUE
        !           323:     END IF
        !           324: 
        !           325:     IF NOT done AND (EOF(fh1%) OR EOF(fh2%)) THEN
        !           326:         diff = TRUE
        !           327:         done = TRUE
        !           328:     END IF
        !           329: 
        !           330:     WHILE NOT done
        !           331: 
        !           332:         LINE INPUT #fh1%,line1$
        !           333:         LINE INPUT #fh2%,line2$
        !           334: 
        !           335:         IF gfError THEN
        !           336:             BFileCmp = FALSE
        !           337:             gErrorType = ET_NOTHING
        !           338:             gfError = FALSE
        !           339:             EXIT FUNCTION
        !           340:         END IF
        !           341: 
        !           342:         IF line1$ <> line2$ THEN
        !           343:             done = TRUE
        !           344:             diff = TRUE
        !           345:         END IF
        !           346: 
        !           347:         IF NOT done AND EOF(fh1%) AND EOF(fh2%) THEN
        !           348:             done = TRUE
        !           349:         END IF
        !           350: 
        !           351:         IF NOT done AND (EOF(fh1%) OR EOF(fh2%)) THEN
        !           352:             diff = TRUE
        !           353:             done = TRUE
        !           354:         END IF
        !           355: 
        !           356:     WEND
        !           357: 
        !           358:     CLOSE #fh1%
        !           359:     CLOSE #fh2%
        !           360: 
        !           361:     IF gfError THEN
        !           362:         BFileCmp = FALSE
        !           363:         gErrorType = ET_NOTHING
        !           364:         gfError = FALSE
        !           365:         EXIT FUNCTION
        !           366:     END IF
        !           367: 
        !           368:     BFileCmp = NOT diff    ' IF different a log failure would normally happen
        !           369: 
        !           370: END FUNCTION
        !           371: 
        !           372: 
        !           373: '
        !           374: ' XDeleteFile(stFileSpec$)
        !           375: '
        !           376: ' Description:
        !           377: '       Will delete stFileSpec$ if it, they, exists.
        !           378: '       logs a failure if it can't delete them or if the file(s)
        !           379: '       doesn't exist
        !           380: '
        !           381: ' Parameters:
        !           382: '       stFileSpec$  - file specification
        !           383: '
        !           384: ' Returns:
        !           385: '       nothing
        !           386: '
        !           387: ' Example:
        !           388: '       XDeleteFile "*.bak"
        !           389: '
        !           390: '
        !           391: SUB XDeleteFile(stFileSpec$) STATIC
        !           392:     IF EXISTS(stFileSpec$) THEN
        !           393:         gErrorType = ET_NEXT
        !           394:         KILL stFileSpec$
        !           395:         IF gfError THEN
        !           396:             XLogFailure "XDeleteFile " + stFileSpec$ + " could NOT be deleted"
        !           397:             gfError = FALSE
        !           398:         END IF
        !           399:         gErrorType = ET_NOTHING
        !           400:     ELSE
        !           401:         XLogFailure "XDeleteFile " + stFileSpec$ + " NOT deleted (doesn't exist)."
        !           402:     END IF
        !           403: END SUB
        !           404: 
        !           405: '
        !           406: ' XDeleteFileIfExists(stFileSpec$)
        !           407: '
        !           408: ' Description:
        !           409: '       Will delete stFileSpec$ if it, they, exists.
        !           410: '       logs a failure if it can't delete them but doesn't if the file(s)
        !           411: '       doesn't exist
        !           412: '
        !           413: ' Parameters:
        !           414: '       stFileSpec$  - file specification
        !           415: '
        !           416: ' Returns:
        !           417: '       nothing
        !           418: '
        !           419: ' Example:
        !           420: '       XDeleteFileIfExists "*.bak"
        !           421: '
        !           422: '
        !           423: SUB XDeleteFileIfExists(stFileSpec$) STATIC
        !           424:     IF EXISTS(stFileSpec$) THEN
        !           425:         gErrorType = ET_NEXT
        !           426:         KILL stFileSpec$
        !           427:         IF gfError THEN
        !           428:             XLogFailure "XDeleteFileIfExists " + stFileSpec$ + " could NOT be deleted"
        !           429:             gfError = FALSE
        !           430:         END IF
        !           431:         gErrorType = ET_NOTHING
        !           432:     END IF
        !           433: END SUB
        !           434: 
        !           435: '
        !           436: ' XCreateFile(stFileSpec$,s$)
        !           437: '
        !           438: ' Description:
        !           439: '       Will Create stFileSpec$ and put string in it
        !           440: '       logs a failure if it can't Create it
        !           441: '
        !           442: ' Parameters:
        !           443: '       stFileSpec$  - file specification
        !           444: '
        !           445: ' Returns:
        !           446: '       nothing
        !           447: '
        !           448: ' Example:
        !           449: '       XCreateFile "foo.dat","Hello world"
        !           450: '
        !           451: '
        !           452: '
        !           453: 
        !           454: SUB XCreateFile(stFileSpec$,s$) STATIC
        !           455:     DIM fh%
        !           456:     gErrorType = ET_NEXT
        !           457:     fh% = FREEFILE
        !           458: 
        !           459:     OPEN stFileSpec$ FOR OUTPUT AS #fh%
        !           460: 
        !           461:     PRINT #fh%,s$       ' put the string in the file
        !           462: 
        !           463:     CLOSE #fh%
        !           464: 
        !           465:     IF gfError THEN
        !           466:         XLogFailure "XCreateFile encountered runtime errors"
        !           467:         gfError = FALSE
        !           468:     END IF
        !           469:     gErrorType = ET_NOTHING
        !           470: 
        !           471: END SUB
        !           472: 
        !           473: '
        !           474: ' XAppendFile(stFileSpec$,s$)
        !           475: '
        !           476: ' Description:
        !           477: '       Will Append stFileSpec$ and put string in it
        !           478: '       logs a failure if it can't Append it
        !           479: '
        !           480: ' Parameters:
        !           481: '       stFileSpec$  - file specification
        !           482: '
        !           483: ' Returns:
        !           484: '       nothing
        !           485: '
        !           486: ' Example:
        !           487: '       XAppendFile "foo.dat","Hello world"
        !           488: '
        !           489: '
        !           490: '
        !           491: 
        !           492: SUB XAppendFile(stFileSpec$,s$) STATIC
        !           493:     DIM fh%
        !           494: 
        !           495:     gErrorType = ET_NEXT
        !           496: 
        !           497:     fh% = FREEFILE
        !           498: 
        !           499:     OPEN stFileSpec$ FOR APPEND AS #fh%
        !           500: 
        !           501:     PRINT #fh%,s$       ' put the string in the file
        !           502: 
        !           503:     CLOSE #fh%
        !           504: 
        !           505:     IF gfError THEN
        !           506:         XLogFailure "XAppendFile encountered runtime errors"
        !           507:         gfError = FALSE
        !           508:     END IF
        !           509:     gErrorType = ET_NOTHING
        !           510: 
        !           511: END SUB
        !           512: 
        !           513: 
        !           514: '
        !           515: ' XWaitMessageFile(s$,Message$,WaitTime%)
        !           516: '
        !           517: ' Description:
        !           518: '       Wait for file to exist, only wait up to given time,
        !           519: '       check if string is in file (if string is non-empty)
        !           520: '       logs a failure if the files doesn't exist, or when
        !           521: '       it does and the string isn't in it.
        !           522: '
        !           523: ' Parameters:
        !           524: '       s$    - file specification
        !           525: '       Message$  - the string to look for
        !           526: '       WaitTime% - the longest to wait
        !           527: '
        !           528: ' Returns:
        !           529: '       nothing
        !           530: '
        !           531: ' Example:
        !           532: '       XWaitMessageFile "foo.dat","Hello world",20
        !           533: '
        !           534: '
        !           535: '
        !           536: 
        !           537: SUB XWaitMessageFile(s$,Message$, WaitTime%) STATIC
        !           538: 
        !           539:     DIM fDone%      ' flag to stop looping
        !           540:     DIM fFound%     ' flag to indicate if file found
        !           541:     DIM lineIn$       ' line from file
        !           542:     DIM inret%      ' return from INSTR
        !           543:     DIM fh%         ' File handle
        !           544: 
        !           545:     fDone = FALSE
        !           546:     fFound = FALSE
        !           547: 
        !           548:     WHILE NOT fDone
        !           549: 
        !           550:         IF EXISTS(s$) THEN
        !           551:             fDone = TRUE
        !           552:             fFound = TRUE
        !           553:         ELSE
        !           554:             SLEEP 1
        !           555: 
        !           556:             WaitTime% = WaitTime% - 1
        !           557:             IF WaitTime% <= 0 THEN
        !           558:                 fDone = TRUE
        !           559:             END IF
        !           560:         END IF
        !           561:     WEND
        !           562: 
        !           563:     IF NOT fFound% THEN
        !           564:         XLogFailure "FAIL """ + s$ + """ Message File not found"
        !           565:     ELSE
        !           566: 
        !           567:         IF Message$ = "" THEN
        !           568:             ' don't bother searching if no string given
        !           569:             EXIT SUB
        !           570:         END IF
        !           571: 
        !           572:         fDone = FALSE
        !           573:         fFOUND = FALSE
        !           574: 
        !           575:         gErrorType = ET_NEXT
        !           576: 
        !           577:         fh% = FREEFILE
        !           578: 
        !           579:         OPEN s$ FOR INPUT AS # fh%
        !           580: 
        !           581:         IF EOF(fh%) THEN
        !           582:             fDone% = TRUE
        !           583:         END IF
        !           584: 
        !           585:         IF gfError THEN
        !           586:             XLogFailure "XWaitMessageFile encountered runtime error during OPEN"
        !           587:             gErrorType = ET_NOTHING
        !           588:             gfError = FALSE
        !           589:             EXIT SUB
        !           590:         END IF
        !           591: 
        !           592:         WHILE NOT fDone%
        !           593: 
        !           594:             LINE INPUT # fh%, lineIn$
        !           595: 
        !           596:             IF gfError THEN
        !           597:                 XLogFailure "XWaitMessageFile encountered runtime error during INPUT"
        !           598:                 gErrorType = ET_NOTHING
        !           599:                 gfError = FALSE
        !           600:                 EXIT SUB
        !           601:             END IF
        !           602: 
        !           603:             inret% = INSTR(lineIn$,Message$)
        !           604: 
        !           605:             IF inret% <> 0 THEN
        !           606:                 fFound% = TRUE
        !           607:                 fDone = TRUE
        !           608:             END IF
        !           609: 
        !           610:             IF EOF(fh%) THEN
        !           611:                 fDone% = TRUE
        !           612:             END IF
        !           613:         WEND
        !           614: 
        !           615:         CLOSE # fh%
        !           616: 
        !           617:         IF gfError THEN
        !           618:             XLogFailure "XWaitMessageFile encountered runtime error during CLOSE"
        !           619:             gErrorType = ET_NOTHING
        !           620:             gfError = FALSE
        !           621:             EXIT SUB
        !           622:         END IF
        !           623:         gErrorType = ET_NOTHING
        !           624: 
        !           625:         IF NOT fFound% THEN
        !           626:             XLogFailure "FAIL, found """ + s$ + """ Message File, """ + Message$ + """ not in it"
        !           627:         END IF
        !           628:     END IF
        !           629: END SUB
        !           630: 
        !           631: '**********************************************************
        !           632: '***************** Directory Subroutines ******************
        !           633: '**********************************************************
        !           634: 
        !           635: '
        !           636: ' XCWDCmp(s$)
        !           637: '
        !           638: ' Description:
        !           639: '       Compare the current working directory and log error if it
        !           640: '       doesn't match the expected value
        !           641: '
        !           642: ' Parameters:
        !           643: '       s$ - the expected value for the current directory
        !           644: '
        !           645: ' Returns:
        !           646: '       nothing
        !           647: '
        !           648: ' Example:
        !           649: '       XCWDCmp "c:\tests"
        !           650: '
        !           651: 
        !           652: SUB XCWDCmp(s$) STATIC
        !           653: 
        !           654:     IF BCWDCmp(s$) = 0 THEN
        !           655:         XLogFailure "Current working directory (" + UCASE$(CURDIR$) + ") doesn't match " + UCASE$(s$)
        !           656:     END IF
        !           657: END SUB
        !           658: 
        !           659: '
        !           660: ' XCWDNotCmp(s$)
        !           661: '
        !           662: ' Description:
        !           663: '       Compare the current working directory and log error if it
        !           664: '       does match the given value
        !           665: '
        !           666: ' Parameters:
        !           667: '       s$ - the value for the directory that isn't expected
        !           668: '
        !           669: ' Returns:
        !           670: '       nothing
        !           671: '
        !           672: ' Example:
        !           673: '       XCWDNotCmp "c:\tests"
        !           674: '
        !           675: 
        !           676: SUB XCWDNotCmp(s$) STATIC
        !           677: 
        !           678:     IF UCASE$(CURDIR$) = UCASE$(s$) THEN
        !           679:         XLogFailure "Current working directory (" + UCASE$(CURDIR$) + ") matches " + UCASE$(s$)
        !           680:     END IF
        !           681: END SUB
        !           682: 
        !           683: '
        !           684: ' BCWDCmp(s$)
        !           685: '
        !           686: ' Description:
        !           687: '       return compare of the current working directory and the expected value
        !           688: '
        !           689: ' Parameters:
        !           690: '       s$ - the expected value for the current directory
        !           691: '
        !           692: ' Returns:
        !           693: '       TRUE if matches, FALSE if doesn't
        !           694: '
        !           695: ' Example:
        !           696: '       flag% = BCWDCmp("c:\tests")
        !           697: '
        !           698: 
        !           699: FUNCTION BCWDCmp%(s$) STATIC
        !           700: 
        !           701:     BCWDCmp = UCASE$(CURDIR$) = UCASE$(s$)
        !           702: 
        !           703: END FUNCTION
        !           704: 
        !           705: '
        !           706: ' XDriveCmp(s$)
        !           707: '
        !           708: ' Description:
        !           709: '       Compare the current working drive and log error if it
        !           710: '       doesn't match the expected value
        !           711: '
        !           712: ' Parameters:
        !           713: '       s$ - the expected value for the current drive
        !           714: '
        !           715: ' Returns:
        !           716: '       nothing
        !           717: '
        !           718: ' Example:
        !           719: '       XDriveCmp "c:"
        !           720: '
        !           721: 
        !           722: SUB XDriveCmp(s$) STATIC
        !           723: 
        !           724:     IF BDriveCmp%(s$) = 0 THEN
        !           725:         XLogFailure "Current working Drive (" + MID$(UCASE$(CURDIR$),1,2) + ") doesn't match " + UCASE$(s$)
        !           726:     END IF
        !           727: END SUB
        !           728: 
        !           729: '
        !           730: ' XDriveNotCmp(s$)
        !           731: '
        !           732: ' Description:
        !           733: '       Compare the current working drive and log error if it
        !           734: '       does match the given value
        !           735: '
        !           736: ' Parameters:
        !           737: '       s$ - the expected value for the current drive
        !           738: '
        !           739: ' Returns:
        !           740: '       nothing
        !           741: '
        !           742: ' Example:
        !           743: '       XDriveNotCmp "c:"
        !           744: '
        !           745: SUB XDriveNotCmp(s$) STATIC
        !           746: 
        !           747:     IF MID$(UCASE$(CURDIR$),1,2) = UCASE$(s$) THEN
        !           748:         XLogFailure "Current working Drive (" + MID$(UCASE$(CURDIR$),1,2) + ") matches " + s$
        !           749:     END IF
        !           750: END SUB
        !           751: 
        !           752: '
        !           753: ' BDriveCmp(s$)
        !           754: '
        !           755: ' Description:
        !           756: '       return compare the current working drive and the expected value
        !           757: '
        !           758: ' Parameters:
        !           759: '       s$ - the expected value for the current drive
        !           760: '
        !           761: ' Returns:
        !           762: '       TRUE if matches, FALSE if doesn't
        !           763: '
        !           764: ' Example:
        !           765: '       flag% = BDriveCmp("c:")
        !           766: '
        !           767: 
        !           768: FUNCTION BDriveCmp%(s$) STATIC
        !           769: 
        !           770:     BDriveCmp = MID$(UCASE$(CURDIR$),1,2) = UCASE$(s$)
        !           771: 
        !           772: END FUNCTION
        !           773: 
        !           774: '
        !           775: ' XChangeCWD(s$)
        !           776: '
        !           777: ' Description:
        !           778: '       Change to given working directory, log failure if doesn't succeed
        !           779: '
        !           780: ' Parameters:
        !           781: '       s$ - directory to change to
        !           782: '
        !           783: ' Returns:
        !           784: '       nothing
        !           785: '
        !           786: ' Example:
        !           787: '       XChangeCWD "\tmp"
        !           788: '
        !           789: '
        !           790: SUB XChangeCWD(s$) STATIC
        !           791:     gErrorType = ET_NEXT
        !           792:     CHDIR s$
        !           793:     IF gfError THEN
        !           794:         XLogFailure "XChangeCWD could not change directory"
        !           795:         gfError = FALSE
        !           796:     END IF
        !           797:     gErrorType = ET_NOTHING
        !           798: END SUB
        !           799: 
        !           800: '
        !           801: ' XCreateDir(s$)
        !           802: '
        !           803: ' Description:
        !           804: '       Create the given directory, log failure if doesn't succeed
        !           805: '
        !           806: ' Parameters:
        !           807: '       s$ - directory to create
        !           808: '
        !           809: ' Returns:
        !           810: '       nothing
        !           811: '
        !           812: ' Example:
        !           813: '       XCreateDir "\tmpdir"
        !           814: '
        !           815: '
        !           816: SUB XCreateDir(s$) STATIC
        !           817:     gErrorType = ET_NEXT
        !           818:     MKDIR s$
        !           819:     IF gfError THEN
        !           820:         XLogFailure "XCreateDir could not create directory"
        !           821:         gfError = FALSE
        !           822:     END IF
        !           823:     gErrorType = ET_NOTHING
        !           824: END SUB
        !           825: 
        !           826: '
        !           827: ' XChangeDrive(s$)
        !           828: '
        !           829: ' Description:
        !           830: '       Change the current working drive, log failure if doesn't succeed
        !           831: '
        !           832: ' Parameters:
        !           833: '       s$ - drive to change to
        !           834: '
        !           835: ' Returns:
        !           836: '       nothing
        !           837: '
        !           838: ' Example:
        !           839: '       XChangeDrive "c:"
        !           840: '
        !           841: '
        !           842: SUB XChangeDrive(s$) STATIC
        !           843:     gErrorType = ET_NEXT
        !           844:     CHDRIVE s$
        !           845:     IF gfError THEN
        !           846:         XLogFailure "XChangeDrive could not change drive"
        !           847:         gfError = FALSE
        !           848:     END IF
        !           849:     gErrorType = ET_NOTHING
        !           850: END SUB
        !           851: 
        !           852: '**********************************************************
        !           853: '***************** Program Subroutines ********************
        !           854: '**********************************************************
        !           855: 
        !           856: 
        !           857: 
        !           858: '
        !           859: ' HStartApp%(stAppName$)
        !           860: '
        !           861: ' Description:
        !           862: '       Starts app AppName and returns the handle to the App
        !           863: '
        !           864: ' Parameters:
        !           865: '       stAppName$  - name of app to WinExec and get handle to
        !           866: '
        !           867: ' Returns:
        !           868: '       handle to application started
        !           869: '
        !           870: ' Example:
        !           871: '       hWinHelp% = HStartApp("winhelp.exe")
        !           872: '
        !           873: '
        !           874: FUNCTION HStartApp%(stAppName$) STATIC
        !           875:     DIM Bogus%, hwndActive%, hwndNewApp%
        !           876:     DIM lpszTemp$
        !           877: 
        !           878:     ' Get the current foreground window
        !           879:     hwndActive = GetForegroundWindow ()
        !           880: 
        !           881:     Bogus% = WinExec (stAppName$, SW_SHOWNORMAL)
        !           882:     lpszTemp$ = "WinExec error with " + stAppName$ + " :"
        !           883: 
        !           884:     ' WinExec defines SOME of the values between 0 and 32
        !           885:     ' as errors... any return value greater than 32
        !           886:     ' should be considered a success!
        !           887:     SELECT CASE Bogus%
        !           888:         CASE 0
        !           889:             XLogFailure lpszTemp$ + "Out of memory - exiting"
        !           890: 
        !           891:         CASE 2
        !           892:             XLogFailure lpszTemp$ + "File not found"
        !           893:             End
        !           894:         CASE 3
        !           895:             XLogFailure lpszTemp$ + "Path not found"
        !           896: 
        !           897:         CASE 5
        !           898:             XLogFailure lpszTemp$ + "Attempt to dynamically link to a task"
        !           899: 
        !           900:         CASE 6
        !           901:             XLogFailure lpszTemp$ + "Library requires separate data segments"
        !           902: 
        !           903:         CASE 10
        !           904:             XLogFailure lpszTemp$ + "Incorrect Windows version"
        !           905: 
        !           906:         CASE 11
        !           907:             XLogFailure lpszTemp$ + "Invalid EXE file"
        !           908: 
        !           909:         CASE 12
        !           910:             XLogFailure lpszTemp$ + "OS/2 application"
        !           911: 
        !           912:         CASE 13
        !           913:             XLogFailure lpszTemp$ + "DOS 4.0 application"
        !           914: 
        !           915:         CASE 14
        !           916:             XLogFailure lpszTemp$ + "Unknown EXE type"
        !           917: 
        !           918:         CASE 15
        !           919:             XLogFailure lpszTemp$ + "Must run in real mode Windows"
        !           920: 
        !           921:         CASE 16
        !           922:             XLogFailure lpszTemp$ + "Cannot run more than one instance"
        !           923: 
        !           924:         CASE 17
        !           925:             XLogFailure lpszTemp$ + "Large-frame EMS allows only one instance"
        !           926: 
        !           927:         CASE 18
        !           928:             XLogFailure lpszTemp$ + "Must run in standard or enhanced mode Windows"
        !           929: 
        !           930:         CASE 0 TO 32
        !           931:             XLogFailure lpszTemp$ + "Unknown Error in WinExec"
        !           932: 
        !           933:      END SELECT
        !           934: 
        !           935:      ' Wait until the old foreground window is no longer the foreground wnd
        !           936:      while hwndActive = GetForegroundWindow
        !           937:         sleep 1
        !           938:      wend
        !           939: 
        !           940:      HStartApp = GetForegroundWindow ()
        !           941: END FUNCTION
        !           942: 
        !           943: '
        !           944: ' XStartApp(stAppName$)
        !           945: '
        !           946: ' Description:
        !           947: '       Starts app AppName and sets handle to ghAppHwnd.
        !           948: '       if we get a null handle, THEN we end the script here.
        !           949: '
        !           950: ' Parameters:
        !           951: '       stAppName$  - name of app to WinExec
        !           952: '
        !           953: ' Returns:
        !           954: '       nothing
        !           955: '
        !           956: ' Example:
        !           957: '       XStartApp "winhelp.exe"
        !           958: '
        !           959: '
        !           960: SUB XStartApp(stAppName$, stClassname$) STATIC
        !           961:     DIM logstr$
        !           962:     'ghAppHwnd is a global
        !           963:     ghAppHwnd = HStartApp(stAppName$)
        !           964:     IF (ghAppHwnd = 0) THEN
        !           965:         'we didn't get a handle
        !           966:         XLogFailure "Unable to start app " + stAppName$
        !           967:     ELSEIF stClassname$ <> "" THEN
        !           968:         gsAppClassname = stClassname$    ' remember it for later
        !           969:         IF FindWindow(stClassname$,NULL) = 0 THEN
        !           970:             ' The app isn't around
        !           971:             logstr$ = "The app " + stAppName$ + " started but didn't stay OR..."
        !           972:             logstr$ = logstr$ + CRLF$ + "the given class name ("
        !           973:             logstr$ = logstr$ +  stClassname$ + ") is incorrect"
        !           974:             XLogFailure logstr$
        !           975:         END IF
        !           976:     END IF
        !           977: END SUB
        !           978: 
        !           979: '
        !           980: ' XSetCleanup(sCleanup$)
        !           981: '
        !           982: ' Description:
        !           983: '       Stores a user defined DoKeys string to be used to exit the
        !           984: '       application automatically.  If set to an empty string,
        !           985: '       nothing will be sent with DoKeys but there will still be
        !           986: '       a log failure if the application is still running when the
        !           987: '       script ends (no check is done if there wasn't a classname
        !           988: '       supplied with XStartApp
        !           989: '
        !           990: ' Parameters:
        !           991: '       sCleanup$ - the string to use with DoKeys to end the app
        !           992: '
        !           993: ' Returns:
        !           994: '       nothing
        !           995: '
        !           996: ' Example:
        !           997: '       XSetCleanup "{esc 5}%vx"
        !           998: '
        !           999: '
        !          1000: SUB XSetCleanup (sCleanup$) STATIC
        !          1001:     gsCleanup$ = sCleanup$
        !          1002: END SUB
        !          1003: 
        !          1004: ' This routine is not intended to be called in the user script.
        !          1005: ' This routine is executed when the script finishes with an END
        !          1006: ' statement.  Its purpose is to find the application started with
        !          1007: ' XStartapp using the classname supplied there.  if it exists,
        !          1008: ' and the gsCleanup string is nonempty, the gsCleanup string will
        !          1009: ' be played.  This may still not get rid of the app for various
        !          1010: ' reasons: maybe it is prompting to save a file, or it won't exit
        !          1011: ' a dialog...
        !          1012: 
        !          1013: SUB XDoCleanup STATIC
        !          1014:     DIM logstr$
        !          1015:     IF gsCleanup$ <> "" AND gsAppClassname$ <> "" AND FindWindow(gsAppClassname$,NULL) <> 0 THEN
        !          1016:         DoKeys gsCleanup$
        !          1017:     END IF
        !          1018:     IF gsAppClassname$ <> "" AND FindWindow(gsAppClassname$,NULL) <> 0 THEN
        !          1019:         logstr$ =  "The app with class name " + gsAppClassname$ + " was not"
        !          1020:         logstr$ = logstr$ + CRLF$ + "halted by the cleanup string " + gsCleanup$
        !          1021:         XLogFailure logstr$
        !          1022:     END IF
        !          1023: 
        !          1024: END SUB
        !          1025: 
        !          1026: 
        !          1027: 
        !          1028: '**********************************************************
        !          1029: '***************** Mouse Subroutines **********************
        !          1030: '**********************************************************
        !          1031: 
        !          1032: ' The mouse routines use the VK_LBUTTON, VK_RBUTTON, VK_MBUTTON
        !          1033: ' constants to determine which button to use (or LBUTTON, MBUTTON or RBUTTON
        !          1034: ' as defined in fasttest.inc
        !          1035: 
        !          1036: 
        !          1037: '
        !          1038: ' XMoveMouse(x%,y%)
        !          1039: '
        !          1040: ' Description:
        !          1041: '       Moves the mouse pointer to specified absolute screen coordinates
        !          1042: '
        !          1043: ' Parameters:
        !          1044: '       x%,y% - x and y coordinates to move to
        !          1045: '
        !          1046: ' Returns:
        !          1047: '       nothing
        !          1048: '
        !          1049: ' Example:
        !          1050: '       XMoveMouse 100,120
        !          1051: '
        !          1052: '
        !          1053: 
        !          1054: SUB XMoveMouse (x%, y%) STATIC
        !          1055: 
        !          1056:     QueMouseMove x%,y%
        !          1057:     QueFlush FALSE
        !          1058: END SUB
        !          1059: 
        !          1060: 
        !          1061: '
        !          1062: ' XClickMouse(button%,x%,y%)
        !          1063: '
        !          1064: ' Description:
        !          1065: '       Clicks the mouse pointer to specified absolute screen coordinates
        !          1066: '
        !          1067: ' Parameters:
        !          1068: '       button% - which button to click
        !          1069: '       x%,y% - x and y coordinates to move to
        !          1070: '
        !          1071: ' Returns:
        !          1072: '       nothing
        !          1073: '
        !          1074: ' Example:
        !          1075: '       XClickMouse LBUTTON,100,120
        !          1076: '
        !          1077: '
        !          1078: 
        !          1079: SUB XClickMouse(button%, x%, y%) STATIC
        !          1080: 
        !          1081:     QueMouseDn button%,x%,y%
        !          1082:     QueMouseUp button%,x%,y%
        !          1083:     QueFlush FALSE
        !          1084: 
        !          1085: END SUB
        !          1086: 
        !          1087: '
        !          1088: ' XDblClickMouse(button%,x%,y%)
        !          1089: '
        !          1090: ' Description:
        !          1091: '       Clicks the mouse pointer to specified absolute screen coordinates
        !          1092: '
        !          1093: ' Parameters:
        !          1094: '       button% - which button to double click
        !          1095: '       x%,y% - x and y coordinates to move to
        !          1096: '
        !          1097: ' Returns:
        !          1098: '       nothing
        !          1099: '
        !          1100: ' Example:
        !          1101: '       XDblClickMouse LBUTTON,100,120
        !          1102: '
        !          1103: '
        !          1104: SUB XDblClickMouse(button%, x%, y%) STATIC
        !          1105: 
        !          1106:     QueMouseDblClk button%,x%,y%
        !          1107:     QueFlush FALSE
        !          1108: 
        !          1109: END SUB
        !          1110: 
        !          1111: '
        !          1112: ' XDragMouse (button%, Begx%, Begy%, Endx%, Endy%)
        !          1113: '
        !          1114: ' Description:
        !          1115: '       Drags the mouse pointer to specified absolute screen coordinates
        !          1116: '
        !          1117: ' Parameters:
        !          1118: '       button% - which button to use for dragging
        !          1119: '       Begx%,Begy% - x and y coordinates to Drag from
        !          1120: '       Endx%,Endy% - x and y coordinates to Drag to
        !          1121: '
        !          1122: ' Returns:
        !          1123: '       nothing
        !          1124: '
        !          1125: ' Example:
        !          1126: '       XDragMouse LBUTTON,100,120, 200,220
        !          1127: '
        !          1128: '
        !          1129: SUB XDragMouse (button%, Begx%, Begy%, Endx%, Endy%) STATIC
        !          1130: 
        !          1131:     QueMouseDn button%,Begx%,Begy%
        !          1132:     QueMouseMove Endx%,Endy%
        !          1133:     QueMouseUp button%,Endx%,Endy%
        !          1134:     QueFlush FALSE
        !          1135: END SUB
        !          1136: 
        !          1137: 
        !          1138: 
        !          1139: 
        !          1140: '**********************************************************
        !          1141: '***************** ClipBoard Subroutines ******************
        !          1142: '**********************************************************
        !          1143: 
        !          1144: 
        !          1145: '
        !          1146: ' XClipBoardCmp(s$)
        !          1147: '
        !          1148: ' Description:
        !          1149: '       Compare given string to what is in the clipboard, log failure
        !          1150: '       if they don't match
        !          1151: '
        !          1152: ' Parameters:
        !          1153: '       s$ - string to compare
        !          1154: '
        !          1155: ' Returns:
        !          1156: '       nothing
        !          1157: '
        !          1158: ' Example:
        !          1159: '       XClipBoardCmp "07734"
        !          1160: '
        !          1161: '
        !          1162: SUB XClipBoardCmp (s$) STATIC
        !          1163: 
        !          1164:     IF s$ <> CLIPBOARD$ THEN
        !          1165:         XLogFailure "String does not match clipboard"
        !          1166:     END IF
        !          1167: END SUB
        !          1168: 
        !          1169: '
        !          1170: ' XClipBoardNotCmp(s$)
        !          1171: '
        !          1172: ' Description:
        !          1173: '       Compare given string to what is in the clipboard, log failure
        !          1174: '       if they match
        !          1175: '
        !          1176: ' Parameters:
        !          1177: '       s$ - string to compare
        !          1178: '
        !          1179: ' Returns:
        !          1180: '       nothing
        !          1181: '
        !          1182: ' Example:
        !          1183: '       XClipBoardNotCmp "07734"
        !          1184: '
        !          1185: '
        !          1186: SUB XClipBoardNotCmp (s$) STATIC
        !          1187: 
        !          1188:     IF s$ = CLIPBOARD$ THEN
        !          1189:         XLogFailure "String does match clipboard"
        !          1190:     END IF
        !          1191: END SUB
        !          1192: 
        !          1193: '
        !          1194: ' BClipBoardCmp(s$)
        !          1195: '
        !          1196: ' Description:
        !          1197: '       Compare given string to what is in the clipboard, log failure
        !          1198: '       if they don't match
        !          1199: '
        !          1200: ' Parameters:
        !          1201: '      s$ - string to compare
        !          1202: '
        !          1203: ' Returns:
        !          1204: '       TRUE if matches, FALSE if doesn't
        !          1205: '
        !          1206: ' Example:
        !          1207: '       flag% = BClipBoardCmp "07734"
        !          1208: '
        !          1209: '
        !          1210: FUNCTION BClipBoardCmp (s$) STATIC
        !          1211: 
        !          1212:     BClipBoardCmp = s$ = CLIPBOARD$
        !          1213: END FUNCTION
        !          1214: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.