1"""
2Test basic std::pair functionality.
3"""
4
5from lldbsuite.test.decorators import *
6from lldbsuite.test.lldbtest import *
7from lldbsuite.test import lldbutil
8
9
10class TestCase(TestBase):
11
12    @add_test_categories(["libc++"])
13    @skipIf(compiler=no_match("clang"))
14    # FIXME: This regressed in 69d5a6662115499198ebfa07a081e98a6ce4b915
15    # but needs further investigation for what underlying Clang/LLDB bug can't
16    # handle that code change.
17    @skipIf
18    def test(self):
19        self.build()
20
21        lldbutil.run_to_source_breakpoint(self,
22                                          "// Set break point at this line.",
23                                          lldb.SBFileSpec("main.cpp"))
24
25        self.runCmd("settings set target.import-std-module true")
26
27        self.expect_expr("pair_int.first",
28                         result_type="int",
29                         result_value="1234")
30        self.expect_expr("pair_int.second",
31                         result_type="int",
32                         result_value="5678")
33        self.expect_expr("pair_int",
34                         result_type="std::pair<int, int>",
35                         result_children=[
36                             ValueCheck(name="first", value="1234"),
37                             ValueCheck(name="second", value="5678"),
38                         ])
39        self.expect_expr(
40            "std::pair<long, long> lp; lp.first = 3333; lp.second = 2344; lp",
41            result_type="std::pair<long, long>",
42            result_children=[
43                ValueCheck(name="first", value="3333"),
44                ValueCheck(name="second", value="2344"),
45            ])
46