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