• Home
  • Raw
  • Download

Lines Matching refs:self

30   def create_test_statement(self, checker_string):  argument
35 def try_match(self, checker_string, c1_string, var_state={}): argument
36 return match_lines(self.create_test_statement(checker_string),
40 def assertMatches(self, checker_string, c1_string, var_state={}): argument
41 self.assertIsNotNone(self.try_match(checker_string, c1_string, var_state))
43 def assertDoesNotMatch(self, checker_string, c1_string, var_state={}): argument
44 self.assertIsNone(self.try_match(checker_string, c1_string, var_state))
46 def test_TextAndWhitespace(self): argument
47 self.assertMatches("foo", "foo")
48 self.assertMatches("foo", " foo ")
49 self.assertMatches("foo", "foo bar")
50 self.assertDoesNotMatch("foo", "XfooX")
51 self.assertDoesNotMatch("foo", "zoo")
53 self.assertMatches("foo bar", "foo bar")
54 self.assertMatches("foo bar", "abc foo bar def")
55 self.assertMatches("foo bar", "foo foo bar bar")
57 self.assertMatches("foo bar", "foo X bar")
58 self.assertDoesNotMatch("foo bar", "foo Xbar")
60 def test_Pattern(self): argument
61 self.assertMatches("foo{{A|B}}bar", "fooAbar")
62 self.assertMatches("foo{{A|B}}bar", "fooBbar")
63 self.assertDoesNotMatch("foo{{A|B}}bar", "fooCbar")
65 def test_VariableReference(self): argument
66 self.assertMatches("foo<<X>>bar", "foobar", {"X": ""})
67 self.assertMatches("foo<<X>>bar", "fooAbar", {"X": "A"})
68 self.assertMatches("foo<<X>>bar", "fooBbar", {"X": "B"})
69 self.assertDoesNotMatch("foo<<X>>bar", "foobar", {"X": "A"})
70 self.assertDoesNotMatch("foo<<X>>bar", "foo bar", {"X": "A"})
71 with self.assertRaises(CheckerException):
72 self.try_match("foo<<X>>bar", "foobar", {})
74 def test_VariableDefinition(self): argument
75 self.assertMatches("foo<<X:A|B>>bar", "fooAbar")
76 self.assertMatches("foo<<X:A|B>>bar", "fooBbar")
77 self.assertDoesNotMatch("foo<<X:A|B>>bar", "fooCbar")
79 env = self.try_match("foo<<X:A.*B>>bar", "fooABbar", {})
80 self.assertEqual(env, {"X": "AB"})
81 env = self.try_match("foo<<X:A.*B>>bar", "fooAxxBbar", {})
82 self.assertEqual(env, {"X": "AxxB"})
84 self.assertMatches("foo<<X:A|B>>bar<<X>>baz", "fooAbarAbaz")
85 self.assertMatches("foo<<X:A|B>>bar<<X>>baz", "fooBbarBbaz")
86 self.assertDoesNotMatch("foo<<X:A|B>>bar<<X>>baz", "fooAbarBbaz")
88 def test_NoVariableRedefinition(self): argument
89 with self.assertRaises(CheckerException):
90 self.try_match("<<X:...>><<X>><<X:...>><<X>>", "foofoobarbar")
92 def test_EnvNotChangedOnPartialMatch(self): argument
94 self.assertDoesNotMatch("<<X:A>>bar", "Abaz", env)
95 self.assertFalse("X" in env.keys())
97 def test_VariableContentEscaped(self): argument
98 self.assertMatches("<<X:..>>foo<<X>>", ".*foo.*")
99 self.assertDoesNotMatch("<<X:..>>foo<<X>>", ".*fooAAAA")
104 def assertMatches(self, checker_string, c1_string, isa=None, instruction_set_features=None): argument
150 def assertDoesNotMatch(self, checker_string, c1_string, isa=None, instruction_set_features=None): argument
151 with self.assertRaises(MatchFailedException):
152 self.assertMatches(checker_string, c1_string, isa, instruction_set_features)
154 def assertBadStructure(self, checker_string, c1_string): argument
155 with self.assertRaises(BadStructureException):
156 self.assertMatches(checker_string, c1_string)
158 def test_Text(self): argument
159 self.assertMatches("/// CHECK: foo bar", "foo bar")
160 self.assertDoesNotMatch("/// CHECK: foo bar", "abc def")
162 def test_Pattern(self): argument
163 self.assertMatches("/// CHECK: abc {{de.}}", "abc de#")
164 self.assertDoesNotMatch("/// CHECK: abc {{de.}}", "abc d#f")
166 def test_Variables(self): argument
167 self.assertMatches(
176 self.assertMatches(
187 self.assertDoesNotMatch(
197 def test_WholeWordMustMatch(self): argument
198 self.assertMatches("/// CHECK: b{{.}}r", "abc bar def")
199 self.assertDoesNotMatch("/// CHECK: b{{.}}r", "abc Xbar def")
200 self.assertDoesNotMatch("/// CHECK: b{{.}}r", "abc barX def")
201 self.assertDoesNotMatch("/// CHECK: b{{.}}r", "abc b r def")
203 def test_InOrderStatements(self): argument
204 self.assertMatches(
213 self.assertDoesNotMatch(
223 def test_NextLineStatements(self): argument
224 self.assertMatches(
237 self.assertMatches(
249 self.assertDoesNotMatch(
260 self.assertDoesNotMatch(
271 def test_DagStatements(self): argument
272 self.assertMatches(
281 self.assertMatches(
291 def test_DagStatementsScope(self): argument
292 self.assertMatches(
305 self.assertDoesNotMatch(
318 self.assertDoesNotMatch(
332 def test_NotStatements(self): argument
333 self.assertMatches(
341 self.assertDoesNotMatch(
349 self.assertDoesNotMatch(
359 def test_NotStatementsScope(self): argument
360 self.assertMatches(
370 self.assertMatches(
381 self.assertDoesNotMatch(
392 self.assertDoesNotMatch(
403 self.assertMatches(
414 self.assertDoesNotMatch(
426 def test_LineOnlyMatchesOnce(self): argument
427 self.assertMatches(
437 self.assertDoesNotMatch(
448 def test_EvalStatements(self): argument
449 self.assertMatches("/// CHECK-EVAL: True", "foo")
450 self.assertDoesNotMatch("/// CHECK-EVAL: False", "foo")
452 self.assertMatches("/// CHECK-EVAL: 1 + 2 == 3", "foo")
453 self.assertDoesNotMatch("/// CHECK-EVAL: 1 + 2 == 4", "foo")
459 self.assertMatches(twoVarTestCase, "42 41")
460 self.assertDoesNotMatch(twoVarTestCase, "42 43")
462 def test_MisplacedNext(self): argument
463 self.assertBadStructure(
472 self.assertBadStructure(
481 self.assertBadStructure(
490 self.assertBadStructure(
499 def test_EnvVariableEval(self): argument
500 self.assertMatches(
509 self.assertMatches(
518 def test_IfStatements(self): argument
519 self.assertMatches(
534 self.assertMatches(
546 self.assertMatches(
561 self.assertDoesNotMatch(
575 def test_IfElseStatements(self): argument
576 self.assertMatches(
591 self.assertMatches(
606 self.assertMatches(
623 self.assertDoesNotMatch(
639 def test_IfElifElseStatements(self): argument
640 self.assertMatches(
657 self.assertMatches(
674 self.assertMatches(
691 self.assertMatches(
707 self.assertDoesNotMatch(
725 def test_NestedBranching(self): argument
726 self.assertMatches(
749 self.assertMatches(
768 self.assertMatches(
791 self.assertDoesNotMatch(
808 def test_VariablesInBranches(self): argument
809 self.assertMatches(
819 self.assertDoesNotMatch(
829 self.assertMatches(
843 self.assertMatches(
855 self.assertMatches(
874 def test_MalformedBranching(self): argument
875 self.assertBadStructure(
883 self.assertBadStructure(
891 self.assertBadStructure(
900 self.assertBadStructure(
913 self.assertBadStructure(
926 self.assertBadStructure(
940 def test_hasIsaFeature(self): argument
942 self.assertMatches(
952 self.assertDoesNotMatch(
962 self.assertMatches(
977 self.assertMatches(
987 self.assertDoesNotMatch(
997 self.assertMatches(