xref: /llvm-project/lldb/test/API/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
164f04629SRaphael Isemannimport lldb
264f04629SRaphael Isemannfrom lldbsuite.test.decorators import *
364f04629SRaphael Isemannfrom lldbsuite.test.lldbtest import *
464f04629SRaphael Isemannfrom lldbsuite.test import lldbutil
599451b44SJordan Rupprecht
664f04629SRaphael Isemann
7*2238dcc3SJonas Devlieghereclass TestCase(TestBase):
864f04629SRaphael Isemann    def test(self):
964f04629SRaphael Isemann        self.build()
10*2238dcc3SJonas Devlieghere        lldbutil.run_to_source_breakpoint(
11*2238dcc3SJonas Devlieghere            self, "// break here", lldb.SBFileSpec("main.cpp")
12*2238dcc3SJonas Devlieghere        )
1364f04629SRaphael Isemann
1464f04629SRaphael Isemann        # Test non-type template parameter packs.
15*2238dcc3SJonas Devlieghere        self.expect_expr(
16*2238dcc3SJonas Devlieghere            "myC",
17*2238dcc3SJonas Devlieghere            result_type="C<int, 16, 32>",
18*2238dcc3SJonas Devlieghere            result_children=[
19*2238dcc3SJonas Devlieghere                ValueCheck(
20*2238dcc3SJonas Devlieghere                    name="C<int, 16>", children=[ValueCheck(name="member", value="64")]
21*2238dcc3SJonas Devlieghere                )
22*2238dcc3SJonas Devlieghere            ],
23*2238dcc3SJonas Devlieghere        )
2464f04629SRaphael Isemann        self.expect_expr("myLesserC.argsAre_16_32()", result_value="false")
2564f04629SRaphael Isemann        self.expect_expr("myC.argsAre_16_32()", result_value="true")
2664f04629SRaphael Isemann
2764f04629SRaphael Isemann        # Test type template parameter packs.
28*2238dcc3SJonas Devlieghere        self.expect_expr(
29*2238dcc3SJonas Devlieghere            "myD",
30*2238dcc3SJonas Devlieghere            result_type="D<int, int, bool>",
31*2238dcc3SJonas Devlieghere            result_children=[
32*2238dcc3SJonas Devlieghere                ValueCheck(
33*2238dcc3SJonas Devlieghere                    name="D<int, int>", children=[ValueCheck(name="member", value="64")]
34*2238dcc3SJonas Devlieghere                )
35*2238dcc3SJonas Devlieghere            ],
36*2238dcc3SJonas Devlieghere        )
3764f04629SRaphael Isemann        self.expect_expr("myLesserD.argsAre_Int_bool()", result_value="false")
3864f04629SRaphael Isemann        self.expect_expr("myD.argsAre_Int_bool()", result_value="true")
3964f04629SRaphael Isemann
4064f04629SRaphael Isemann        # Disabling until we do template lookup correctly: http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20180507/040689.html
4164f04629SRaphael Isemann        # FIXME: Rewrite this with expect_expr
4264f04629SRaphael Isemann        # self.expect("expression -- C<int, 16>().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"])
4364f04629SRaphael Isemann        # self.expect("expression -- C<int, 16, 32>().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
4464f04629SRaphael Isemann        # self.expect("expression -- D<int, int>().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"])
4564f04629SRaphael Isemann        # self.expect("expression -- D<int, int, bool>().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
46