Lines Matching refs:self
39 def setUp(self): argument
42 self.stream = MockStream()
44 def testReadFunction(self): argument
51 self.stream = MockStream.concat_int(self.stream, ident)
52 self.stream = MockStream.concat_int(self.stream, 0)
53 self.stream = MockStream.concat_int(self.stream, 0)
57 self.stream = MockStream.concat_string(self.stream, name)
58 self.stream = MockStream.concat_string(self.stream, src_file_name)
59 self.stream = MockStream.concat_int(self.stream, first_line_number)
60 parser = gcno_parser.GCNOParser(self.stream)
62 self.assertEqual(name, summary.name)
63 self.assertEqual(ident, summary.ident)
64 self.assertEqual(src_file_name, summary.src_file_name)
65 self.assertEqual(first_line_number, summary.first_line_number)
67 def testReadBlocks(self): argument
75 self.stream = MockStream.concat_int(self.stream, 3 * i)
76 parser = gcno_parser.GCNOParser(self.stream)
78 self.assertEqual(len(func.blocks), n_blocks)
80 self.assertEqual(func.blocks[i].flag, 3 * i)
81 self.assertEqual(func.blocks[i].index, i)
83 def testReadArcsNormal(self): argument
96 self.stream = MockStream.concat_int(self.stream, src_block_index)
98 self.stream = MockStream.concat_int(self.stream, i)
99 self.stream = MockStream.concat_int(
100 self.stream, 0) # no flag applied to the arc
101 parser = gcno_parser.GCNOParser(self.stream)
106 self.assertEqual(
109 self.assertEqual(
111 self.assertEqual(func.blocks[i].entry_arcs[0].src_block.index,
113 self.assertEqual(func.blocks[i].entry_arcs[0].dst_block.index, i)
116 def testReadArcFlags(self): argument
123 self.stream = MockStream.concat_int(self.stream,
126 self.stream = MockStream.concat_int(self.stream, 1) # normal arc
127 self.stream = MockStream.concat_int(self.stream, 0)
129 self.stream = MockStream.concat_int(self.stream, 2) # on-tree arc
130 self.stream = MockStream.concat_int(
131 self.stream, arc_summary.ArcSummary.GCOV_ARC_ON_TREE)
133 self.stream = MockStream.concat_int(self.stream, 3) # fake arc
134 self.stream = MockStream.concat_int(
135 self.stream, arc_summary.ArcSummary.GCOV_ARC_FAKE)
137 self.stream = MockStream.concat_int(self.stream, 4) # fallthrough arc
138 self.stream = MockStream.concat_int(
139 self.stream, arc_summary.ArcSummary.GCOV_ARC_FALLTHROUGH)
141 parser = gcno_parser.GCNOParser(self.stream)
144 self.assertFalse(func.blocks[0].exit_arcs[0].on_tree)
145 self.assertFalse(func.blocks[0].exit_arcs[0].fake)
146 self.assertFalse(func.blocks[0].exit_arcs[0].fallthrough)
148 self.assertTrue(func.blocks[0].exit_arcs[1].on_tree)
149 self.assertFalse(func.blocks[0].exit_arcs[1].fake)
150 self.assertFalse(func.blocks[0].exit_arcs[1].fallthrough)
152 self.assertFalse(func.blocks[0].exit_arcs[2].on_tree)
153 self.assertTrue(func.blocks[0].exit_arcs[2].fake)
154 self.assertFalse(func.blocks[0].exit_arcs[2].fallthrough)
156 self.assertFalse(func.blocks[0].exit_arcs[3].on_tree)
157 self.assertFalse(func.blocks[0].exit_arcs[3].fake)
158 self.assertTrue(func.blocks[0].exit_arcs[3].fallthrough)
160 def testReadLines(self): argument
166 self.stream = MockStream.concat_int(self.stream, 2) # block number
167 self.stream = MockStream.concat_int(self.stream, 0) # dummy
171 self.stream = MockStream.concat_string(self.stream, name)
174 self.stream = MockStream.concat_int(self.stream, i)
180 parser = gcno_parser.GCNOParser(self.stream)
182 self.assertEqual(len(func.blocks[2].lines), 5)
183 self.assertEqual(func.blocks[2].lines, range(1, 6))
185 def testSampleFile(self): argument
192 file_path = os.path.join(dir_path, self.GOLDEN_GCNO_PATH)
194 self.assertEqual(len(summary.functions), 2)
198 self.assertEqual(func.name, 'testFunctionName')
199 self.assertEqual(func.src_file_name, 'sample.c')
200 self.assertEqual(func.first_line_number, 35)
201 self.assertEqual(len(func.blocks), 5)
204 self.assertEqual(func.blocks[index].lines, expected)
208 self.assertEqual(func.name, 'main')
209 self.assertEqual(func.first_line_number, 5)
210 self.assertEqual(len(func.blocks), 12)
211 self.assertEqual(func.blocks[0].lines, [])
215 self.assertEqual(func.blocks[index].lines, expected)