예제 #1
0
    def getCoverageData(self, testCaseSeq):
        c = self.conn.cursor()

        SELECT_SQL = """
        SELECT file, line FROM {0}
        WHERE case_seq = {1}
        """.format(TestCaseDB.CASE_COVERAGE_TABLE_NAME, testCaseSeq)

        c.execute(SELECT_SQL)

        result = {}
        row = c.fetchone()
        while row:
            scriptName = row[0]
            lineSet = set(string.split(row[1]))

            rangeSet = []
            for aLine in lineSet:
                rangeSet.append(Range.parseFrom(aLine))
            rangeSet.sort()

            covInfo = CoverageRange(scriptName, rangeSet)

            result[scriptName] = covInfo

            row = c.fetchone()

        return result
예제 #2
0
class RangeTest(unittest.TestCase):

    def setUp(self):
        self.aRange = Range(1, 10)

    def testInit(self):
        self.assertEqual(self.aRange.getFirst(), 1)
        self.assertEqual(self.aRange.getLast(), 10)

    def testInRange(self):
        self.assertTrue(self.aRange.contains(1))
        self.assertTrue(self.aRange.contains(10))
        self.assertTrue(self.aRange.contains(5))
        self.assertFalse(self.aRange.contains(0))
        self.assertFalse(self.aRange.contains(11))
예제 #3
0
 def setUp(self):
     self.aRange = Range(1, 10)