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    mydir = TestBase.compute_mydir(__file__)
13
14    @add_test_categories(["libc++"])
15    @skipIf(compiler=no_match("clang"))
16    def test(self):
17        self.build()
18
19        lldbutil.run_to_source_breakpoint(self,
20                                          "// Set break point at this line.",
21                                          lldb.SBFileSpec("main.cpp"))
22
23        self.runCmd("settings set target.import-std-module true")
24
25        self.expect_expr("pair_int.first",
26                         result_type="int",
27                         result_value="1234")
28        self.expect_expr("pair_int.second",
29                         result_type="int",
30                         result_value="5678")
31        self.expect_expr("pair_int",
32                         result_type="std::pair<int, int>",
33                         result_children=[
34                             ValueCheck(name="first", value="1234"),
35                             ValueCheck(name="second", value="5678"),
36                         ])
37        self.expect_expr(
38            "std::pair<long, long> lp; lp.first = 3333; lp.second = 2344; lp",
39            result_type="std::pair<long, long>",
40            result_children=[
41                ValueCheck(name="first", value="3333"),
42                ValueCheck(name="second", value="2344"),
43            ])
44