brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · 5e819b7 Raw
73 lines · python
1"""2Test basic std::list functionality.3"""4 5from lldbsuite.test.decorators import *6from lldbsuite.test.lldbtest import *7from lldbsuite.test import lldbutil8 9 10class TestBasicDeque(TestBase):11    @add_test_categories(["libc++"])12    @skipIf(compiler=no_match("clang"))13    @skipIf(macos_version=["<", "15.0"])14    @skipIf(15        bugnumber="ASTImport of lambdas not supported: https://github.com/llvm/llvm-project/issues/149477"16    )17    def test(self):18        self.build()19 20        lldbutil.run_to_source_breakpoint(21            self, "// Set break point at this line.", lldb.SBFileSpec("main.cpp")22        )23 24        self.runCmd("settings set target.import-std-module true")25 26        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(27            [">", "16.0"]28        ):29            deque_type = "std::deque<int>"30        else:31            deque_type = "std::deque<int, std::allocator<int> >"32 33        size_type = "size_type"34        value_type = "value_type"35        iterator = "iterator"36        iterator_children = [ValueCheck(name="__m_iter_"), ValueCheck(name="__ptr_")]37        riterator = "reverse_iterator"38        riterator_children = [39            ValueCheck(),  # Deprecated __t_ member; no need to check40            ValueCheck(name="current"),41        ]42 43        self.expect_expr(44            "a",45            result_type=deque_type,46            result_children=[47                ValueCheck(value="3"),48                ValueCheck(value="1"),49                ValueCheck(value="2"),50            ],51        )52 53        self.expect_expr("a.size()", result_type=size_type, result_value="3")54        self.expect_expr("a.front()", result_type=value_type, result_value="3")55        self.expect_expr("a.back()", result_type=value_type, result_value="2")56 57        self.expect("expr std::sort(a.begin(), a.end())")58        self.expect_expr("a.front()", result_type=value_type, result_value="1")59        self.expect_expr("a.back()", result_type=value_type, result_value="3")60 61        self.expect("expr std::reverse(a.begin(), a.end())")62        self.expect_expr("a.front()", result_type=value_type, result_value="3")63        self.expect_expr("a.back()", result_type=value_type, result_value="1")64 65        self.expect_expr("*a.begin()", result_type="int", result_value="3")66        self.expect_expr("*a.rbegin()", result_type="int", result_value="1")67        self.expect_expr(68            "a.begin()", result_type=iterator, result_children=iterator_children69        )70        self.expect_expr(71            "a.rbegin()", result_type=riterator, result_children=riterator_children72        )73