Lines Matching refs:self

32   def createTestStatement(self, checkerString):  argument
37 def tryMatch(self, checkerString, c1String, varState={}): argument
38 return MatchLines(self.createTestStatement(checkerString),
42 def assertMatches(self, checkerString, c1String, varState={}): argument
43 self.assertIsNotNone(self.tryMatch(checkerString, c1String, varState))
45 def assertDoesNotMatch(self, checkerString, c1String, varState={}): argument
46 self.assertIsNone(self.tryMatch(checkerString, c1String, varState))
48 def test_TextAndWhitespace(self): argument
49 self.assertMatches("foo", "foo")
50 self.assertMatches("foo", " foo ")
51 self.assertMatches("foo", "foo bar")
52 self.assertDoesNotMatch("foo", "XfooX")
53 self.assertDoesNotMatch("foo", "zoo")
55 self.assertMatches("foo bar", "foo bar")
56 self.assertMatches("foo bar", "abc foo bar def")
57 self.assertMatches("foo bar", "foo foo bar bar")
59 self.assertMatches("foo bar", "foo X bar")
60 self.assertDoesNotMatch("foo bar", "foo Xbar")
62 def test_Pattern(self): argument
63 self.assertMatches("foo{{A|B}}bar", "fooAbar")
64 self.assertMatches("foo{{A|B}}bar", "fooBbar")
65 self.assertDoesNotMatch("foo{{A|B}}bar", "fooCbar")
67 def test_VariableReference(self): argument
68 self.assertMatches("foo<<X>>bar", "foobar", {"X": ""})
69 self.assertMatches("foo<<X>>bar", "fooAbar", {"X": "A"})
70 self.assertMatches("foo<<X>>bar", "fooBbar", {"X": "B"})
71 self.assertDoesNotMatch("foo<<X>>bar", "foobar", {"X": "A"})
72 self.assertDoesNotMatch("foo<<X>>bar", "foo bar", {"X": "A"})
73 with self.assertRaises(CheckerException):
74 self.tryMatch("foo<<X>>bar", "foobar", {})
76 def test_VariableDefinition(self): argument
77 self.assertMatches("foo<<X:A|B>>bar", "fooAbar")
78 self.assertMatches("foo<<X:A|B>>bar", "fooBbar")
79 self.assertDoesNotMatch("foo<<X:A|B>>bar", "fooCbar")
81 env = self.tryMatch("foo<<X:A.*B>>bar", "fooABbar", {})
82 self.assertEqual(env, {"X": "AB"})
83 env = self.tryMatch("foo<<X:A.*B>>bar", "fooAxxBbar", {})
84 self.assertEqual(env, {"X": "AxxB"})
86 self.assertMatches("foo<<X:A|B>>bar<<X>>baz", "fooAbarAbaz")
87 self.assertMatches("foo<<X:A|B>>bar<<X>>baz", "fooBbarBbaz")
88 self.assertDoesNotMatch("foo<<X:A|B>>bar<<X>>baz", "fooAbarBbaz")
90 def test_NoVariableRedefinition(self): argument
91 with self.assertRaises(CheckerException):
92 self.tryMatch("<<X:...>><<X>><<X:...>><<X>>", "foofoobarbar")
94 def test_EnvNotChangedOnPartialMatch(self): argument
96 self.assertDoesNotMatch("<<X:A>>bar", "Abaz", env)
97 self.assertFalse("X" in env.keys())
99 def test_VariableContentEscaped(self): argument
100 self.assertMatches("<<X:..>>foo<<X>>", ".*foo.*")
101 self.assertDoesNotMatch("<<X:..>>foo<<X>>", ".*fooAAAA")
106 def assertMatches(self, checkerString, c1String, isa=None, instructionSetFeatures=None): argument
154 def assertDoesNotMatch(self, checkerString, c1String, isa=None, instructionSetFeatures=None): argument
155 with self.assertRaises(MatchFailedException):
156 self.assertMatches(checkerString, c1String, isa, instructionSetFeatures)
158 def assertBadStructure(self, checkerString, c1String): argument
159 with self.assertRaises(BadStructureException):
160 self.assertMatches(checkerString, c1String)
162 def test_Text(self): argument
163 self.assertMatches("/// CHECK: foo bar", "foo bar")
164 self.assertDoesNotMatch("/// CHECK: foo bar", "abc def")
166 def test_Pattern(self): argument
167 self.assertMatches("/// CHECK: abc {{de.}}", "abc de#")
168 self.assertDoesNotMatch("/// CHECK: abc {{de.}}", "abc d#f")
170 def test_Variables(self): argument
171 self.assertMatches(
180 self.assertMatches(
191 self.assertDoesNotMatch(
201 def test_WholeWordMustMatch(self): argument
202 self.assertMatches("/// CHECK: b{{.}}r", "abc bar def")
203 self.assertDoesNotMatch("/// CHECK: b{{.}}r", "abc Xbar def")
204 self.assertDoesNotMatch("/// CHECK: b{{.}}r", "abc barX def")
205 self.assertDoesNotMatch("/// CHECK: b{{.}}r", "abc b r def")
207 def test_InOrderStatements(self): argument
208 self.assertMatches(
217 self.assertDoesNotMatch(
227 def test_NextLineStatements(self): argument
228 self.assertMatches(
241 self.assertMatches(
253 self.assertDoesNotMatch(
264 self.assertDoesNotMatch(
275 def test_DagStatements(self): argument
276 self.assertMatches(
285 self.assertMatches(
295 def test_DagStatementsScope(self): argument
296 self.assertMatches(
309 self.assertDoesNotMatch(
322 self.assertDoesNotMatch(
336 def test_NotStatements(self): argument
337 self.assertMatches(
345 self.assertDoesNotMatch(
353 self.assertDoesNotMatch(
363 def test_NotStatementsScope(self): argument
364 self.assertMatches(
374 self.assertMatches(
385 self.assertDoesNotMatch(
396 self.assertDoesNotMatch(
407 self.assertMatches(
418 self.assertDoesNotMatch(
430 def test_LineOnlyMatchesOnce(self): argument
431 self.assertMatches(
441 self.assertDoesNotMatch(
452 def test_EvalStatements(self): argument
453 self.assertMatches("/// CHECK-EVAL: True", "foo")
454 self.assertDoesNotMatch("/// CHECK-EVAL: False", "foo")
456 self.assertMatches("/// CHECK-EVAL: 1 + 2 == 3", "foo")
457 self.assertDoesNotMatch("/// CHECK-EVAL: 1 + 2 == 4", "foo")
463 self.assertMatches(twoVarTestCase, "42 41");
464 self.assertDoesNotMatch(twoVarTestCase, "42 43")
466 def test_MisplacedNext(self): argument
467 self.assertBadStructure(
476 self.assertBadStructure(
485 self.assertBadStructure(
494 self.assertBadStructure(
503 def test_EnvVariableEval(self): argument
504 self.assertMatches(
513 self.assertMatches(
522 def test_IfStatements(self): argument
523 self.assertMatches(
538 self.assertMatches(
550 self.assertMatches(
565 self.assertDoesNotMatch(
579 def test_IfElseStatements(self): argument
580 self.assertMatches(
595 self.assertMatches(
610 self.assertMatches(
627 self.assertDoesNotMatch(
643 def test_IfElifElseStatements(self): argument
644 self.assertMatches(
661 self.assertMatches(
678 self.assertMatches(
695 self.assertMatches(
711 self.assertDoesNotMatch(
729 def test_NestedBranching(self): argument
730 self.assertMatches(
753 self.assertMatches(
772 self.assertMatches(
795 self.assertDoesNotMatch(
812 def test_VariablesInBranches(self): argument
813 self.assertMatches(
823 self.assertDoesNotMatch(
833 self.assertMatches(
847 self.assertMatches(
859 self.assertMatches(
878 def test_MalformedBranching(self): argument
879 self.assertBadStructure(
887 self.assertBadStructure(
895 self.assertBadStructure(
904 self.assertBadStructure(
917 self.assertBadStructure(
930 self.assertBadStructure(
944 def test_hasIsaFeature(self): argument
946 self.assertMatches(
956 self.assertDoesNotMatch(
966 self.assertMatches(
981 self.assertMatches(
991 self.assertDoesNotMatch(
1001 self.assertMatches(