-
Notifications
You must be signed in to change notification settings - Fork 10.7k
/
TestScopedEnumType.py
44 lines (32 loc) · 1.51 KB
/
TestScopedEnumType.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class ExprXValuePrintingTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def test(self):
self.build()
self.main_source = "main.cpp"
self.main_source_spec = lldb.SBFileSpec(self.main_source)
(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self,
'// Set break point at this line.', self.main_source_spec)
frame = thread.GetFrameAtIndex(0)
self.expect("expr f == Foo::FooBar",
substrs=['(bool) $0 = true'])
value = frame.EvaluateExpression("f == Foo::FooBar")
self.assertTrue(value.IsValid())
self.assertTrue(value.GetError().Success())
self.assertEqual(value.GetValueAsUnsigned(), 1)
value = frame.EvaluateExpression("b == BarBar")
self.assertTrue(value.IsValid())
self.assertTrue(value.GetError().Success())
self.assertEqual(value.GetValueAsUnsigned(), 1)
## b is not a Foo
value = frame.EvaluateExpression("b == Foo::FooBar")
self.assertTrue(value.IsValid())
self.assertFalse(value.GetError().Success())
## integral is not implicitly convertible to a scoped enum
value = frame.EvaluateExpression("1 == Foo::FooBar")
self.assertTrue(value.IsValid())
self.assertFalse(value.GetError().Success())