Lines Matching +full:a +full:- +full:b

2 # SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
14 a = Event('a')
15 b = Event('b')
16 self.assertEqual((a | b).ToPerfJson(), 'a | b')
17 self.assertEqual((a ^ b).ToPerfJson(), 'a ^ b')
18 self.assertEqual((a & b).ToPerfJson(), 'a & b')
19 self.assertEqual((a < b).ToPerfJson(), 'a < b')
20 self.assertEqual((a > b).ToPerfJson(), 'a > b')
21 self.assertEqual((a + b).ToPerfJson(), 'a + b')
22 self.assertEqual((a - b).ToPerfJson(), 'a - b')
23 self.assertEqual((a * b).ToPerfJson(), 'a * b')
24 self.assertEqual((a / b).ToPerfJson(), 'a / b')
25 self.assertEqual((a % b).ToPerfJson(), 'a % b')
27 self.assertEqual((a + one).ToPerfJson(), 'a + 1')
30 a = Event('a')
31 b = Event('b')
33 self.assertEqual((a * b + c).ToPerfJson(), 'a * b + c')
34 self.assertEqual((a + b * c).ToPerfJson(), 'a + b * c')
35 self.assertEqual(((a + a) + a).ToPerfJson(), 'a + a + a')
36 self.assertEqual(((a + b) * c).ToPerfJson(), '(a + b) * c')
37 self.assertEqual((a + (b * c)).ToPerfJson(), 'a + b * c')
38 self.assertEqual(((a / b) * c).ToPerfJson(), 'a / b * c')
39 self.assertEqual((a / (b * c)).ToPerfJson(), 'a / (b * c)')
42 # Based on an example of a real metric.
43 before = '(a + b + c + d) / (2 * e)'
47 # Parsing should handle events with '-' in their name. Note, in
49 before = r'topdown\-fe\-bound / topdown\-slots - 1'
60 before = r'a + 1e12 + b'
65 # if-else needs rewriting to Select and back.
89 before = r'min(a + b if c > 1 else c + d, e + f)'
90 after = r'min((a + b if c > 1 else c + d), e + f)'
93 before = r'a if b else c if d else e'
94 after = r'(a if b else (c if d else e))'
98 # pylint: disable=eval-used
99 # Based on an example of a real metric.
100 before = '(a + b + c + d) / (2 * e)'
110 before = 'a + 0'
111 after = 'a'
114 before = '0 + a'
115 after = 'a'
118 before = 'a | 0'
119 after = 'a'
122 before = '0 | a'
123 after = 'a'
126 before = 'a * 0'
130 before = '0 * a'
134 before = 'a * 1'
135 after = 'a'
138 before = '1 * a'
139 after = 'a'
142 before = 'a if 0 else b'
143 after = 'b'
146 before = 'a if 1 else b'
147 after = 'a'
150 before = 'a if b else a'
151 after = 'a'
154 # Pattern used to add a slots event to metrics that require it.
161 before = [('cpu', 'm1', ParsePerfJson('a + b + c + d')),
162 ('cpu', 'm2', ParsePerfJson('a + b + c'))]