MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / TestMatcher

Class TestMatcher

src/scripts/porting-script/tests/matcher_tests.py:15–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14
15class TestMatcher(unittest.TestCase):
16 def setUp(self):
17 self.file_type_dict = {}
18 self.file_type_dict["cppfiles"] = ["./cpp/ice_rxtx_vec_avx2.c"]
19 mather_factory = MatcherFactory(self.file_type_dict)
20 self.matcher = mather_factory.get_matcher(MatcherType.CppMatcher)
21
22 def test_cpp(self):
23 results = self.matcher.match()
24 # print(results.file_path)
25 self.assertGreaterEqual(len(results), 1)
26
27 def test_macro_branch_judge(self):
28 """[['if', 308, '#if __x86__', 'x86'], ['elif', 310, '#elif aarch64', 'arm'], ['elif', 312,
29 #elif mips', 'mips'], ['endif', 316, '#endif', 'all']]"""
30 input = [['if', 308, '#if __x86__', 'x86'], ['elif', 310, '#elif aarch64', 'arm'],
31 ['elif', 312, '#elif mips', 'mips'], ['endif', 316, '#endif', 'all']]
32 start, end, need = self.matcher.macro_branch_judge(input)
33 self.assertEqual(need, 0)
34
35 input = [['if', 308, '#if __x86__', 'x86'], ['elif', 310, '#elif shenwei', 'all'],
36 ['elif', 312, '#elif mips', 'mips'], ['endif', 316, '#endif', 'all']]
37 start, end, need = self.matcher.macro_branch_judge(input)
38 self.assertEqual(need, 1)
39
40 input = [['ifndef', 308, '#ifndef arrch64', 'all'], ['elif', 310, '#elif aarch64', 'arm'],
41 ['elif', 312, '#elif mips', 'mips'], ['endif', 316, '#endif', 'all']]
42 start, end, need = self.matcher.macro_branch_judge(input)
43 self.assertEqual(need, 0)
44
45if __name__ == "__main__":
46 # create test suite

Callers 1

matcher_tests.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected