Example #1
0
import testCommon


def printUsage():
    usageMsg = '\n\n\t./testParse.py goes into examples folder and attempts '
    usageMsg += 'to lex and parse all of the files with the .wld extension within it.  '
    usageMsg += 'It then compares the parsed output with the .out version of the '
    usageMsg += 'file.  Ie, it would parse test1.wld and compare the parsed output with '
    usageMsg += 'test1.wld.out.  If they agree, pass.  If they do not, then fail.\n'
    print(usageMsg)


def parseTestToRun(progText):
    outputStream = testCommon.StreamLike()
    head.lexAndParse(progText, outputStream, 2)
    return outputStream.flush()


if __name__ == '__main__':
    if len(sys.argv) != 1:
        printUsage()
    else:
        detailsStream = testCommon.StreamLike()
        testCommon.runTests(parseTestToRun, TEST_FOLDER_NAME, detailsStream)

        # write out the details
        filer = open(DETAILS_FILE, 'w')
        filer.write(detailsStream.flush())
        filer.flush()
        filer.close()
Example #2
0

def printUsage():
    usageMsg = '\n\n\t./testSlice.py goes into examples folder and attempts ';
    usageMsg += 'to slice all of the files with the .wld extension within it.  ';
    usageMsg += 'It then compares the sliced output with the .out version of the ';
    usageMsg += 'file.  Ie, it would lex, parse, and slice test1.wld and compare the sliced output with ';
    usageMsg += 'test1.wld.out.  If they agree, pass.  If they do not, then fail.\n';
    print(usageMsg);


    
def sliceTestToRun(progText):
    outputStream = testCommon.StreamLike();
    return testSlicer.runText(progText);
    

if __name__ == '__main__':
    if len(sys.argv) != 1:
        printUsage();
    else:
        detailsStream = testCommon.StreamLike();
        testCommon.runTests(sliceTestToRun,TEST_FOLDER_NAME,detailsStream);

        # write out the details
        filer = open(DETAILS_FILE,'w');
        filer.write(detailsStream.flush());
        filer.flush();
        filer.close();
        
Example #3
0
curPath = os.path.dirname(__file__);
lexPath = os.path.join(curPath,'..','..','lexer');
sys.path.append(lexPath);
import basicLexTest;

sys.path.append(os.path.join(curPath,'..','util'));
import testCommon;


def printUsage():
    usageMsg = '\n\n\t./testLex.py goes into examples folder and attempts ';
    usageMsg += 'to lex all of the files with the .wld extension within it.  ';
    usageMsg += 'It then compares the lexed output with the .out version of the ';
    usageMsg += 'file.  Ie, it would lex test1.wld and compare the lex output with ';
    usageMsg += 'test1.wld.out.  If they agree, pass.  If they do not, then fail.\n';
    print(usageMsg);


if __name__ == '__main__':
    if len(sys.argv) != 1:
        printUsage();
    else:
        detailsStream = testCommon.StreamLike();
        testCommon.runTests(basicLexTest.lexText,TEST_FOLDER_NAME,detailsStream);

        # write out the details
        filer = open(DETAILS_FILE,'w');
        filer.write(detailsStream.flush());
        filer.flush();
        filer.close();