Revert "[ELF] Refine isExported/isPreemptible condition"
[llvm-project.git] / lldb / test / API / lang / cpp / stl / TestSTL.py
blobee4f04661610f9bb8eb339862eb1d07bc3e2de96
1 """
2 Test some expressions involving STL data types.
3 """
6 import lldb
7 from lldbsuite.test.decorators import *
8 from lldbsuite.test.lldbtest import *
9 from lldbsuite.test import lldbutil
12 class STLTestCase(TestBase):
13 @expectedFailureAll(bugnumber="llvm.org/PR36713")
14 def test(self):
15 """Test some expressions involving STL data types."""
16 self.build()
17 lldbutil.run_to_source_breakpoint(
18 self, "// Set break point at this line", lldb.SBFileSpec("main.cpp")
21 # Now try some expressions....
23 self.runCmd(
24 'expr for (int i = 0; i < hello_world.length(); ++i) { (void)printf("%c\\n", hello_world[i]); }'
27 self.expect("expr associative_array.size()", substrs=[" = 3"])
28 self.expect("expr associative_array.count(hello_world)", substrs=[" = 1"])
29 self.expect("expr associative_array[hello_world]", substrs=[" = 1"])
30 self.expect('expr associative_array["hello"]', substrs=[" = 2"])
32 @expectedFailureAll(
33 compiler="icc",
34 bugnumber="ICC (13.1, 14-beta) do not emit DW_TAG_template_type_parameter.",
36 @add_test_categories(["pyapi"])
37 def test_SBType_template_aspects(self):
38 """Test APIs for getting template arguments from an SBType."""
39 self.build()
40 (_, _, thread, _) = lldbutil.run_to_source_breakpoint(
41 self, "// Set break point at this line", lldb.SBFileSpec("main.cpp")
43 frame0 = thread.GetFrameAtIndex(0)
45 # Get the type for variable 'associative_array'.
46 associative_array = frame0.FindVariable("associative_array")
47 self.DebugSBValue(associative_array)
48 self.assertTrue(associative_array, VALID_VARIABLE)
49 map_type = associative_array.GetType()
50 self.DebugSBType(map_type)
51 self.assertTrue(map_type, VALID_TYPE)
52 num_template_args = map_type.GetNumberOfTemplateArguments()
53 self.assertGreater(num_template_args, 0)
55 # We expect the template arguments to contain at least 'string' and
56 # 'int'.
57 expected_types = {"string": False, "int": False}
58 for i in range(num_template_args):
59 t = map_type.GetTemplateArgumentType(i)
60 self.DebugSBType(t)
61 self.assertTrue(t, VALID_TYPE)
62 name = t.GetName()
63 if "string" in name:
64 expected_types["string"] = True
65 elif "int" == name:
66 expected_types["int"] = True
68 # Check that both entries of the dictionary have 'True' as the value.
69 self.assertTrue(all(expected_types.values()))