2 Test lldb data formatter subsystem.
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
13 class TestDataFormatterLibcxxBitset(TestBase):
15 mydir = TestBase.compute_mydir(__file__)
21 primes[0] = primes[1] = 0
22 for i in range(2, len(primes)):
23 for j in range(2*i, len(primes), i):
27 def check(self, name, size):
28 var = self.frame().FindVariable(name)
29 self.assertTrue(var.IsValid())
30 self.assertEqual(var.GetNumChildren(), size)
32 child = var.GetChildAtIndex(i)
33 self.assertEqual(child.GetValueAsUnsigned(), self.primes[i],
34 "variable: %s, index: %d"%(name, size))
36 @add_test_categories(["libc++"])
38 """Test that std::bitset is displayed correctly"""
40 lldbutil.run_to_source_breakpoint(self, '// break here',
41 lldb.SBFileSpec("main.cpp", False))
43 self.check("empty", 0)
44 self.check("small", 13)
45 self.check("large", 200)
47 @add_test_categories(["libc++"])
48 def test_ptr_and_ref(self):
49 """Test that ref and ptr to std::bitset is displayed correctly"""
51 (_, process, _, bkpt) = lldbutil.run_to_source_breakpoint(self,
53 lldb.SBFileSpec("main.cpp", False))
58 lldbutil.continue_to_breakpoint(process, bkpt)
60 self.check("ref", 200)
61 self.check("ptr", 200)