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, argument
160 def assertDoesNotMatch(self, checker_string, c1_string, argument
164 with self.assertRaises(MatchFailedException):
165 … self.assertMatches(checker_string, c1_string, isa, instruction_set_features, read_barrier_type)
167 def assertBadStructure(self, checker_string, c1_string): argument
168 with self.assertRaises(BadStructureException):
169 self.assertMatches(checker_string, c1_string)
171 def test_Text(self): argument
172 self.assertMatches("/// CHECK: foo bar", "foo bar")
173 self.assertDoesNotMatch("/// CHECK: foo bar", "abc def")
175 def test_Pattern(self): argument
176 self.assertMatches("/// CHECK: abc {{de.}}", "abc de#")
177 self.assertDoesNotMatch("/// CHECK: abc {{de.}}", "abc d#f")
179 def test_Variables(self): argument
180 self.assertMatches(
189 self.assertMatches(
200 self.assertDoesNotMatch(
210 def test_WholeWordMustMatch(self): argument
211 self.assertMatches("/// CHECK: b{{.}}r", "abc bar def")
212 self.assertDoesNotMatch("/// CHECK: b{{.}}r", "abc Xbar def")
213 self.assertDoesNotMatch("/// CHECK: b{{.}}r", "abc barX def")
214 self.assertDoesNotMatch("/// CHECK: b{{.}}r", "abc b r def")
216 def test_InOrderStatements(self): argument
217 self.assertMatches(
226 self.assertDoesNotMatch(
236 def test_NextLineStatements(self): argument
237 self.assertMatches(
250 self.assertMatches(
262 self.assertDoesNotMatch(
273 self.assertDoesNotMatch(
284 def test_DagStatements(self): argument
285 self.assertMatches(
294 self.assertMatches(
304 def test_DagStatementsScope(self): argument
305 self.assertMatches(
318 self.assertDoesNotMatch(
331 self.assertDoesNotMatch(
345 def test_NotStatements(self): argument
346 self.assertMatches(
354 self.assertDoesNotMatch(
362 self.assertDoesNotMatch(
372 def test_NotStatementsScope(self): argument
373 self.assertMatches(
383 self.assertMatches(
394 self.assertDoesNotMatch(
405 self.assertDoesNotMatch(
416 self.assertMatches(
427 self.assertDoesNotMatch(
439 def test_LineOnlyMatchesOnce(self): argument
440 self.assertMatches(
450 self.assertDoesNotMatch(
461 def test_EvalStatements(self): argument
462 self.assertMatches("/// CHECK-EVAL: True", "foo")
463 self.assertDoesNotMatch("/// CHECK-EVAL: False", "foo")
465 self.assertMatches("/// CHECK-EVAL: 1 + 2 == 3", "foo")
466 self.assertDoesNotMatch("/// CHECK-EVAL: 1 + 2 == 4", "foo")
472 self.assertMatches(twoVarTestCase, "42 41")
473 self.assertDoesNotMatch(twoVarTestCase, "42 43")
475 def test_MisplacedNext(self): argument
476 self.assertBadStructure(
485 self.assertBadStructure(
494 self.assertBadStructure(
503 self.assertBadStructure(
512 def test_EnvVariableEval(self): argument
513 self.assertMatches(
522 self.assertMatches(
531 def test_IfStatements(self): argument
532 self.assertMatches(
547 self.assertMatches(
559 self.assertMatches(
574 self.assertDoesNotMatch(
588 def test_IfElseStatements(self): argument
589 self.assertMatches(
604 self.assertMatches(
619 self.assertMatches(
636 self.assertDoesNotMatch(
652 def test_IfElifElseStatements(self): argument
653 self.assertMatches(
670 self.assertMatches(
687 self.assertMatches(
704 self.assertMatches(
720 self.assertDoesNotMatch(
738 def test_NestedBranching(self): argument
739 self.assertMatches(
762 self.assertMatches(
781 self.assertMatches(
804 self.assertDoesNotMatch(
821 def test_VariablesInBranches(self): argument
822 self.assertMatches(
832 self.assertDoesNotMatch(
842 self.assertMatches(
856 self.assertMatches(
868 self.assertMatches(
887 def test_MalformedBranching(self): argument
888 self.assertBadStructure(
896 self.assertBadStructure(
904 self.assertBadStructure(
913 self.assertBadStructure(
926 self.assertBadStructure(
939 self.assertBadStructure(
953 def test_hasIsaFeature(self): argument
955 self.assertMatches(
965 self.assertDoesNotMatch(
975 self.assertMatches(
990 self.assertMatches(
1000 self.assertDoesNotMatch(
1010 self.assertMatches(
1026 def test_readBarrierType(self): argument
1028 self.assertMatches(
1038 self.assertDoesNotMatch(
1048 self.assertDoesNotMatch(
1060 self.assertMatches(
1070 self.assertDoesNotMatch(
1080 self.assertDoesNotMatch(
1092 self.assertMatches(
1102 self.assertDoesNotMatch(
1112 self.assertDoesNotMatch(
1124 self.assertMatches(
1139 self.assertMatches(
1156 self.assertMatches(
1171 self.assertMatches(
1188 self.assertMatches(
1203 self.assertMatches(