Esempio n. 1
0
File: test.py Progetto: COS-Temp/art
 def createFile(self, caseList):
   testFile = CheckerFile("<test_file>")
   for caseEntry in caseList:
     caseName = caseEntry[0]
     testCase = TestCase(testFile, caseName, 0)
     assertionList = caseEntry[1]
     for assertionEntry in assertionList:
       content = assertionEntry[0]
       variant = assertionEntry[1]
       assertion = TestAssertion(testCase, variant, content, 0)
       assertion.addExpression(TestExpression.createPatternFromPlainText(content))
   return testFile
Esempio n. 2
0
 def createFile(self, caseList):
   testFile = CheckerFile("<test_file>")
   for caseEntry in caseList:
     caseName = caseEntry[0]
     testCase = TestCase(testFile, caseName, 0)
     statementList = caseEntry[1]
     for statementEntry in statementList:
       content = statementEntry[0]
       variant = statementEntry[1]
       statement = TestStatement(testCase, variant, content, 0)
       statement.addExpression(TestExpression.createPatternFromPlainText(content))
   return testFile
Esempio n. 3
0
def ParseCheckerStream(fileName, prefix, stream):
    checkerFile = CheckerFile(fileName)
    fnProcessLine = lambda line, lineNo: __processLine(line, lineNo, prefix,
                                                       fileName)
    fnLineOutsideChunk = lambda line, lineNo: \
        Logger.fail("Checker line not inside a group", fileName, lineNo)
    for caseName, caseLines, startLineNo, testArch in \
        SplitStream(stream, fnProcessLine, fnLineOutsideChunk):
        testCase = TestCase(checkerFile, caseName, startLineNo, testArch)
        for caseLine in caseLines:
            ParseCheckerAssertion(testCase, caseLine[0], caseLine[1],
                                  caseLine[2])
    return checkerFile
Esempio n. 4
0
def ParseCheckerStream(fileName, prefix, stream, targetArch=None):
    checkerFile = CheckerFile(fileName)
    fnProcessLine = lambda line, lineNo: __processLine(line, lineNo, prefix,
                                                       fileName, targetArch)
    fnLineOutsideChunk = lambda line, lineNo: \
        Logger.fail("Checker line not inside a group", fileName, lineNo)
    for caseName, caseLines, startLineNo, testData in \
        SplitStream(stream, fnProcessLine, fnLineOutsideChunk):
        testArch = testData[0]
        forDebuggable = testData[1]
        testCase = TestCase(checkerFile, caseName, startLineNo, testArch,
                            forDebuggable)
        for caseLine in caseLines:
            ParseCheckerStatement(testCase, caseLine[0], caseLine[1],
                                  caseLine[2])
    return checkerFile
Esempio n. 5
0
 def create_file(self, case_list):
     test_file = CheckerFile("<test_file>")
     for caseEntry in case_list:
         case_name = caseEntry[0]
         test_case = TestCase(test_file, case_name, 0)
         statement_list = caseEntry[1]
         for statementEntry in statement_list:
             content = statementEntry[0]
             variant = statementEntry[1]
             statement = TestStatement(test_case, variant, content, 0)
             if statement.is_eval_content_statement():
                 statement.add_expression(
                     TestExpression.create_plain_text(content))
             elif statement.is_pattern_match_content_statement():
                 statement.add_expression(
                     TestExpression.create_pattern_from_plain_text(content))
     return test_file
Esempio n. 6
0
def parse_checker_stream(file_name, prefix, stream, target_arch=None):
    checker_file = CheckerFile(file_name)

    def fn_process_line(line, line_no):
        return _process_line(line, line_no, prefix, file_name, target_arch)

    def fn_line_outside_chunk(line, line_no):
        Logger.fail("Checker line not inside a group", file_name, line_no)

    for case_name, case_lines, start_line_no, test_data in split_stream(
            stream, fn_process_line, fn_line_outside_chunk):
        test_arch = test_data[0]
        for_debuggable = test_data[1]
        test_case = TestCase(checker_file, case_name, start_line_no, test_arch,
                             for_debuggable)
        for case_line in case_lines:
            parse_checker_statement(test_case, case_line[0], case_line[1],
                                    case_line[2])
    return checker_file
Esempio n. 7
0
 def createTestStatement(self, checkerString):
     checkerFile = CheckerFile("<checker-file>")
     testCase = TestCase(checkerFile, "TestMethod TestPass", 0)
     return ParseCheckerStatement(testCase, checkerString,
                                  TestStatement.Variant.InOrder, 0)