xref: /llvm-project/lldb/test/API/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1import lldb
2from lldbsuite.test.decorators import *
3from lldbsuite.test.lldbtest import *
4from lldbsuite.test import lldbutil
5
6
7class TestCase(TestBase):
8    def test(self):
9        self.build()
10        lldbutil.run_to_source_breakpoint(
11            self, "// break here", lldb.SBFileSpec("main.cpp")
12        )
13
14        # Test non-type template parameter packs.
15        self.expect_expr(
16            "myC",
17            result_type="C<int, 16, 32>",
18            result_children=[
19                ValueCheck(
20                    name="C<int, 16>", children=[ValueCheck(name="member", value="64")]
21                )
22            ],
23        )
24        self.expect_expr("myLesserC.argsAre_16_32()", result_value="false")
25        self.expect_expr("myC.argsAre_16_32()", result_value="true")
26
27        # Test type template parameter packs.
28        self.expect_expr(
29            "myD",
30            result_type="D<int, int, bool>",
31            result_children=[
32                ValueCheck(
33                    name="D<int, int>", children=[ValueCheck(name="member", value="64")]
34                )
35            ],
36        )
37        self.expect_expr("myLesserD.argsAre_Int_bool()", result_value="false")
38        self.expect_expr("myD.argsAre_Int_bool()", result_value="true")
39
40        # Disabling until we do template lookup correctly: http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20180507/040689.html
41        # FIXME: Rewrite this with expect_expr
42        # self.expect("expression -- C<int, 16>().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"])
43        # self.expect("expression -- C<int, 16, 32>().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
44        # self.expect("expression -- D<int, int>().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"])
45        # self.expect("expression -- D<int, int, bool>().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
46