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